OLD | NEW |
---|---|
(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 UI_DEVTOOLS_DEVTOOLS_CLIENT_H_ | |
6 #define UI_DEVTOOLS_DEVTOOLS_CLIENT_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "ui/devtools/DOM.h" | |
11 #include "ui/devtools/Forward.h" | |
12 #include "ui/devtools/Protocol.h" | |
13 #include "ui/devtools/string_util.h" | |
14 | |
15 namespace ui { | |
16 namespace devtools { | |
17 | |
18 class UiDevToolsServer; | |
19 | |
20 // Every UI component that wants to be inspectable must instantiate | |
21 // this class and attach the corresponding backends/frontends (i.e: DOM, CSS, | |
22 // etc). This client is then attached to the UiDevToolsServer and all messages | |
23 // from this client are sent over the web socket owned by the server. | |
24 class UiDevToolsClient : public protocol::FrontendChannel { | |
25 public: | |
26 static const int kNotConnected = -1; | |
27 | |
28 UiDevToolsClient(const String& name, UiDevToolsServer* server); | |
sadrul
2016/10/18 20:29:37
Let's use const std::string& here. (you probably d
Sarmad Hashmi
2016/10/19 23:56:02
Done.
| |
29 ~UiDevToolsClient() override; | |
30 | |
31 void AddDOMBackend(std::unique_ptr<protocol::DOM::Backend> dom_backend); | |
32 void Dispatch(const String& data); | |
33 | |
34 bool connected() const; | |
35 void set_connection_id(int connection_id); | |
36 std::string name() const; | |
sadrul
2016/10/18 20:29:37
return a const-ref as well, i.e.:
const std::str
Sarmad Hashmi
2016/10/19 23:56:02
Done.
| |
37 | |
38 private: | |
39 // protocol::FrontendChannel | |
40 void sendProtocolResponse(int callId, const String& message) override; | |
41 void sendProtocolNotification(const String& message) override; | |
42 void flushProtocolNotifications() override; | |
43 | |
44 std::string name_; | |
45 int connection_id_; | |
46 | |
47 std::unique_ptr<protocol::DOM::Backend> dom_backend_; | |
48 protocol::UberDispatcher dispatcher_; | |
49 UiDevToolsServer* server_; | |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(UiDevToolsClient); | |
52 }; | |
53 | |
54 } // namespace devtools | |
55 } // namespace ui | |
56 | |
57 #endif // UI_DEVTOOLS_DEVTOOLS_CLIENT_H_ | |
OLD | NEW |