Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Side by Side Diff: components/ui_devtools/devtools_base_agent.h

Issue 2456643002: Create a base agent class for ui_devtools (Closed)
Patch Set: sadruls comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/ui_devtools/BUILD.gn ('k') | components/ui_devtools/devtools_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_UI_DEVTOOLS_DEVTOOLS_BASE_AGENT_H_
6 #define COMPONENTS_UI_DEVTOOLS_DEVTOOLS_BASE_AGENT_H_
7
8 #include "components/ui_devtools/Protocol.h"
9
10 namespace ui {
11 namespace devtools {
12
13 class UiDevToolsAgent {
14 public:
15 UiDevToolsAgent() {}
16 virtual ~UiDevToolsAgent() {}
17
18 virtual void init(protocol::UberDispatcher*) = 0;
sadrul 2016/10/29 05:49:15 Init. (Should've caught this in the first iteratio
Sarmad Hashmi 2016/10/29 16:11:09 Done.
19 };
20
21 // A base agent so that any Backend implementation has access to the
22 // corresponding frontend instance. This also wires the backend with
23 // the dispatcher. When initializing an instance of this class,
24 // the template argument is simply the generated Metainfo class of
25 // any domain type such as DOM or CSS.
26 template <typename DomainMetainfo>
27 class UiDevToolsBaseAgent : public UiDevToolsAgent,
28 public DomainMetainfo::BackendClass {
29 public:
30 void init(protocol::UberDispatcher* dispatcher) {
sadrul 2016/10/29 05:49:15 Init
Sarmad Hashmi 2016/10/29 16:11:09 Done.
31 frontend_.reset(
32 new typename DomainMetainfo::FrontendClass(dispatcher->channel()));
33 DomainMetainfo::DispatcherClass::wire(dispatcher, this);
34 }
35
36 protected:
37 UiDevToolsBaseAgent() {}
38 typename DomainMetainfo::FrontendClass* frontend() const {
39 return frontend_.get();
40 }
41
42 private:
43 std::unique_ptr<typename DomainMetainfo::FrontendClass> frontend_;
44
45 DISALLOW_COPY_AND_ASSIGN(UiDevToolsBaseAgent);
46 };
47
48 } // namespace devtools
49 } // namespace ui
50
51 #endif // COMPONENTS_UI_DEVTOOLS_DEVTOOLS_BASE_AGENT_H_
OLDNEW
« no previous file with comments | « components/ui_devtools/BUILD.gn ('k') | components/ui_devtools/devtools_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698