1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16#ifndef ECMASCRIPT_TOOLING_AGENT_PAGE_IMPL_H 17#define ECMASCRIPT_TOOLING_AGENT_PAGE_IMPL_H 18 19#include "base/pt_params.h" 20#include "base/pt_returns.h" 21#include "dispatcher.h" 22 23#include "libpandabase/macros.h" 24 25namespace panda::ecmascript::tooling { 26class PageImpl final { 27public: 28 PageImpl() = default; 29 ~PageImpl() = default; 30 31 class DispatcherImpl final : public DispatcherBase { 32 public: 33 DispatcherImpl(ProtocolChannel *channel, std::unique_ptr<PageImpl> page) 34 : DispatcherBase(channel), page_(std::move(page)) {} 35 ~DispatcherImpl() override = default; 36 void GetNavigationHistory(const DispatchRequest &request); 37 void Dispatch(const DispatchRequest &request) override; 38 39 enum class Method { 40 GET_NAVIGATION_HISTORY, 41 UNKNOWN 42 }; 43 Method GetMethodEnum(const std::string& method); 44 45 private: 46 NO_COPY_SEMANTIC(DispatcherImpl); 47 NO_MOVE_SEMANTIC(DispatcherImpl); 48 49 std::unique_ptr<PageImpl> page_ {}; 50 }; 51 52private: 53 NO_COPY_SEMANTIC(PageImpl); 54 NO_MOVE_SEMANTIC(PageImpl); 55}; 56} // namespace panda::ecmascript::tooling 57#endif