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

Side by Side Diff: components/ui_devtools/devtools_client.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/devtools_base_agent.h ('k') | components/ui_devtools/devtools_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_CLIENT_H_ 5 #ifndef COMPONENTS_UI_DEVTOOLS_DEVTOOLS_CLIENT_H_
6 #define COMPONENTS_UI_DEVTOOLS_DEVTOOLS_CLIENT_H_ 6 #define COMPONENTS_UI_DEVTOOLS_DEVTOOLS_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "components/ui_devtools/DOM.h" 10 #include "components/ui_devtools/DOM.h"
11 #include "components/ui_devtools/Forward.h" 11 #include "components/ui_devtools/Forward.h"
12 #include "components/ui_devtools/Protocol.h" 12 #include "components/ui_devtools/Protocol.h"
13 #include "components/ui_devtools/devtools_base_agent.h"
13 14
14 namespace ui { 15 namespace ui {
15 namespace devtools { 16 namespace devtools {
16 17
17 class UiDevToolsServer; 18 class UiDevToolsServer;
18 19
19 // Every UI component that wants to be inspectable must instantiate 20 // Every UI component that wants to be inspectable must instantiate
20 // this class and attach the corresponding backends/frontends (i.e: DOM, CSS, 21 // this class and attach the corresponding backends/frontends (i.e: DOM, CSS,
21 // etc). This client is then attached to the UiDevToolsServer and all messages 22 // etc). This client is then attached to the UiDevToolsServer and all messages
22 // from this client are sent over the web socket owned by the server. 23 // from this client are sent over the web socket owned by the server.
23 class UiDevToolsClient : public protocol::FrontendChannel { 24 class UiDevToolsClient : public protocol::FrontendChannel {
24 public: 25 public:
25 static const int kNotConnected = -1; 26 static const int kNotConnected = -1;
26 27
27 UiDevToolsClient(const std::string& name, UiDevToolsServer* server); 28 UiDevToolsClient(const std::string& name, UiDevToolsServer* server);
28 ~UiDevToolsClient() override; 29 ~UiDevToolsClient() override;
29 30
30 void AddDOMBackend(std::unique_ptr<protocol::DOM::Backend> dom_backend); 31 void AddAgent(std::unique_ptr<UiDevToolsAgent> agent);
32 // TODO(mhashmi): Remove when ash is updated to use the new base agent
33 void AddDOMBackend(std::unique_ptr<protocol::DOM::Backend> backend);
31 void Dispatch(const std::string& data); 34 void Dispatch(const std::string& data);
32 35
33 bool connected() const; 36 bool connected() const;
34 void set_connection_id(int connection_id); 37 void set_connection_id(int connection_id);
35 const std::string& name() const; 38 const std::string& name() const;
36 39
37 private: 40 private:
38 // protocol::FrontendChannel 41 // protocol::FrontendChannel
39 void sendProtocolResponse(int callId, const String& message) override; 42 void sendProtocolResponse(int callId, const String& message) override;
40 void sendProtocolNotification(const String& message) override; 43 void sendProtocolNotification(const String& message) override;
41 void flushProtocolNotifications() override; 44 void flushProtocolNotifications() override;
42 45
43 std::string name_; 46 std::string name_;
44 int connection_id_; 47 int connection_id_;
45 48
49 std::vector<std::unique_ptr<UiDevToolsAgent>> agents_;
46 std::unique_ptr<protocol::DOM::Backend> dom_backend_; 50 std::unique_ptr<protocol::DOM::Backend> dom_backend_;
47 protocol::UberDispatcher dispatcher_; 51 protocol::UberDispatcher dispatcher_;
48 UiDevToolsServer* server_; 52 UiDevToolsServer* server_;
49 53
50 DISALLOW_COPY_AND_ASSIGN(UiDevToolsClient); 54 DISALLOW_COPY_AND_ASSIGN(UiDevToolsClient);
51 }; 55 };
52 56
53 } // namespace devtools 57 } // namespace devtools
54 } // namespace ui 58 } // namespace ui
55 59
56 #endif // COMPONENTS_UI_DEVTOOLS_DEVTOOLS_CLIENT_H_ 60 #endif // COMPONENTS_UI_DEVTOOLS_DEVTOOLS_CLIENT_H_
OLDNEW
« no previous file with comments | « components/ui_devtools/devtools_base_agent.h ('k') | components/ui_devtools/devtools_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698