Chromium Code Reviews| 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 | |
|
sadrul
2016/10/17 17:44:36
There should be a _ at the end.
Sarmad Hashmi
2016/10/17 19:15:29
Done.
| |
| 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 UiDevToolsClient(const String& name, UiDevToolsServer* server); | |
| 27 ~UiDevToolsClient() override; | |
| 28 | |
| 29 void AddDOMBackend(std::unique_ptr<protocol::DOM::Backend> dom_backend); | |
| 30 | |
| 31 private: | |
| 32 static const int kNotConnected = -1; | |
| 33 | |
| 34 friend class UiDevToolsServer; | |
| 35 void Dispatch(const String& data); | |
| 36 bool connected(); | |
| 37 | |
| 38 // protocol::FrontendChannel | |
| 39 void sendProtocolResponse(int callId, const String& message) override; | |
| 40 void sendProtocolNotification(const String& message) override; | |
| 41 void flushProtocolNotifications() override; | |
| 42 | |
| 43 std::string name_; | |
| 44 int connection_id_; | |
| 45 | |
| 46 std::unique_ptr<protocol::DOM::Backend> dom_backend_; | |
| 47 protocol::UberDispatcher dispatcher_; | |
| 48 UiDevToolsServer* server_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(UiDevToolsClient); | |
| 51 }; | |
| 52 | |
| 53 } // namespace devtools | |
| 54 } // namespace ui | |
| 55 | |
| 56 #endif // UI_DEVTOOLS_DEVTOOLS_CLIENT_H_ | |
| OLD | NEW |