| 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_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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // 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 |
| 23 // 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. |
| 24 class UiDevToolsClient : public protocol::FrontendChannel { | 24 class UiDevToolsClient : public protocol::FrontendChannel { |
| 25 public: | 25 public: |
| 26 static const int kNotConnected = -1; | 26 static const int kNotConnected = -1; |
| 27 | 27 |
| 28 UiDevToolsClient(const std::string& name, UiDevToolsServer* server); | 28 UiDevToolsClient(const std::string& name, UiDevToolsServer* server); |
| 29 ~UiDevToolsClient() override; | 29 ~UiDevToolsClient() override; |
| 30 | 30 |
| 31 void AddAgent(std::unique_ptr<UiDevToolsAgent> agent); | 31 void AddAgent(std::unique_ptr<UiDevToolsAgent> agent); |
| 32 void Disconnect(); |
| 32 void Dispatch(const std::string& data); | 33 void Dispatch(const std::string& data); |
| 33 | 34 |
| 34 bool connected() const; | 35 bool connected() const; |
| 35 void set_connection_id(int connection_id); | 36 void set_connection_id(int connection_id); |
| 36 const std::string& name() const; | 37 const std::string& name() const; |
| 37 | 38 |
| 38 private: | 39 private: |
| 40 void DisableAllAgents(); |
| 41 |
| 39 // protocol::FrontendChannel | 42 // protocol::FrontendChannel |
| 40 void sendProtocolResponse(int callId, const String& message) override; | 43 void sendProtocolResponse(int callId, const String& message) override; |
| 41 void sendProtocolNotification(const String& message) override; | 44 void sendProtocolNotification(const String& message) override; |
| 42 void flushProtocolNotifications() override; | 45 void flushProtocolNotifications() override; |
| 43 | 46 |
| 44 std::string name_; | 47 std::string name_; |
| 45 int connection_id_; | 48 int connection_id_; |
| 46 | 49 |
| 47 std::vector<std::unique_ptr<UiDevToolsAgent>> agents_; | 50 std::vector<std::unique_ptr<UiDevToolsAgent>> agents_; |
| 48 protocol::UberDispatcher dispatcher_; | 51 protocol::UberDispatcher dispatcher_; |
| 49 UiDevToolsServer* server_; | 52 UiDevToolsServer* server_; |
| 50 | 53 |
| 51 DISALLOW_COPY_AND_ASSIGN(UiDevToolsClient); | 54 DISALLOW_COPY_AND_ASSIGN(UiDevToolsClient); |
| 52 }; | 55 }; |
| 53 | 56 |
| 54 } // namespace devtools | 57 } // namespace devtools |
| 55 } // namespace ui | 58 } // namespace ui |
| 56 | 59 |
| 57 #endif // COMPONENTS_UI_DEVTOOLS_DEVTOOLS_CLIENT_H_ | 60 #endif // COMPONENTS_UI_DEVTOOLS_DEVTOOLS_CLIENT_H_ |
| OLD | NEW |