OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_UI_DEVTOOLS_DEVTOOLS_BASE_AGENT_H_ | 5 #ifndef COMPONENTS_UI_DEVTOOLS_DEVTOOLS_BASE_AGENT_H_ |
6 #define COMPONENTS_UI_DEVTOOLS_DEVTOOLS_BASE_AGENT_H_ | 6 #define COMPONENTS_UI_DEVTOOLS_DEVTOOLS_BASE_AGENT_H_ |
7 | 7 |
8 #include "components/ui_devtools/Protocol.h" | 8 #include "components/ui_devtools/Protocol.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui_devtools { |
11 namespace devtools { | |
12 | 11 |
13 class UiDevToolsAgent { | 12 class UiDevToolsAgent { |
14 public: | 13 public: |
15 UiDevToolsAgent() {} | 14 UiDevToolsAgent() {} |
16 virtual ~UiDevToolsAgent() {} | 15 virtual ~UiDevToolsAgent() {} |
17 | 16 |
18 virtual void Init(protocol::UberDispatcher*) = 0; | 17 virtual void Init(protocol::UberDispatcher*) = 0; |
19 virtual void Disable() = 0; | 18 virtual void Disable() = 0; |
20 }; | 19 }; |
21 | 20 |
(...skipping 10 matching lines...) Expand all Loading... |
32 void Init(protocol::UberDispatcher* dispatcher) override { | 31 void Init(protocol::UberDispatcher* dispatcher) override { |
33 frontend_.reset( | 32 frontend_.reset( |
34 new typename DomainMetainfo::FrontendClass(dispatcher->channel())); | 33 new typename DomainMetainfo::FrontendClass(dispatcher->channel())); |
35 DomainMetainfo::DispatcherClass::wire(dispatcher, this); | 34 DomainMetainfo::DispatcherClass::wire(dispatcher, this); |
36 } | 35 } |
37 | 36 |
38 void Disable() override { disable(); } | 37 void Disable() override { disable(); } |
39 | 38 |
40 // Common methods between all generated Backends, subclasses may | 39 // Common methods between all generated Backends, subclasses may |
41 // choose to override them (but not necessary). | 40 // choose to override them (but not necessary). |
42 ui::devtools::protocol::Response enable() override { | 41 ui_devtools::protocol::Response enable() override { |
43 return ui::devtools::protocol::Response::OK(); | 42 return ui_devtools::protocol::Response::OK(); |
44 }; | 43 }; |
45 | 44 |
46 ui::devtools::protocol::Response disable() override { | 45 ui_devtools::protocol::Response disable() override { |
47 return ui::devtools::protocol::Response::OK(); | 46 return ui_devtools::protocol::Response::OK(); |
48 }; | 47 }; |
49 | 48 |
50 protected: | 49 protected: |
51 UiDevToolsBaseAgent() {} | 50 UiDevToolsBaseAgent() {} |
52 typename DomainMetainfo::FrontendClass* frontend() const { | 51 typename DomainMetainfo::FrontendClass* frontend() const { |
53 return frontend_.get(); | 52 return frontend_.get(); |
54 } | 53 } |
55 | 54 |
56 private: | 55 private: |
57 std::unique_ptr<typename DomainMetainfo::FrontendClass> frontend_; | 56 std::unique_ptr<typename DomainMetainfo::FrontendClass> frontend_; |
58 | 57 |
59 DISALLOW_COPY_AND_ASSIGN(UiDevToolsBaseAgent); | 58 DISALLOW_COPY_AND_ASSIGN(UiDevToolsBaseAgent); |
60 }; | 59 }; |
61 | 60 |
62 } // namespace devtools | 61 } // namespace ui_devtools |
63 } // namespace ui | |
64 | 62 |
65 #endif // COMPONENTS_UI_DEVTOOLS_DEVTOOLS_BASE_AGENT_H_ | 63 #endif // COMPONENTS_UI_DEVTOOLS_DEVTOOLS_BASE_AGENT_H_ |
OLD | NEW |