| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/devtools/device/devtools_android_bridge.h" | 5 #include "chrome/browser/devtools/device/devtools_android_bridge.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 class ProtocolCommand | 178 class ProtocolCommand |
| 179 : public DevToolsAndroidBridge::AndroidWebSocket::Delegate { | 179 : public DevToolsAndroidBridge::AndroidWebSocket::Delegate { |
| 180 public: | 180 public: |
| 181 ProtocolCommand( | 181 ProtocolCommand( |
| 182 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser, | 182 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser, |
| 183 const std::string& debug_url, | 183 const std::string& debug_url, |
| 184 const std::string& command, | 184 const std::string& command, |
| 185 const base::Closure callback); | 185 const base::Closure callback); |
| 186 | 186 |
| 187 private: | 187 private: |
| 188 virtual void OnSocketOpened() OVERRIDE; | 188 virtual void OnSocketOpened() override; |
| 189 virtual void OnFrameRead(const std::string& message) OVERRIDE; | 189 virtual void OnFrameRead(const std::string& message) override; |
| 190 virtual void OnSocketClosed() OVERRIDE; | 190 virtual void OnSocketClosed() override; |
| 191 virtual ~ProtocolCommand(); | 191 virtual ~ProtocolCommand(); |
| 192 | 192 |
| 193 const std::string command_; | 193 const std::string command_; |
| 194 const base::Closure callback_; | 194 const base::Closure callback_; |
| 195 scoped_ptr<DevToolsAndroidBridge::AndroidWebSocket> web_socket_; | 195 scoped_ptr<DevToolsAndroidBridge::AndroidWebSocket> web_socket_; |
| 196 | 196 |
| 197 DISALLOW_COPY_AND_ASSIGN(ProtocolCommand); | 197 DISALLOW_COPY_AND_ASSIGN(ProtocolCommand); |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 ProtocolCommand::ProtocolCommand( | 200 ProtocolCommand::ProtocolCommand( |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 const std::string& id, | 281 const std::string& id, |
| 282 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser, | 282 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser, |
| 283 const std::string& debug_url); | 283 const std::string& debug_url); |
| 284 | 284 |
| 285 private: | 285 private: |
| 286 AgentHostDelegate( | 286 AgentHostDelegate( |
| 287 const std::string& id, | 287 const std::string& id, |
| 288 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser, | 288 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser, |
| 289 const std::string& debug_url); | 289 const std::string& debug_url); |
| 290 virtual ~AgentHostDelegate(); | 290 virtual ~AgentHostDelegate(); |
| 291 virtual void Attach(content::DevToolsExternalAgentProxy* proxy) OVERRIDE; | 291 virtual void Attach(content::DevToolsExternalAgentProxy* proxy) override; |
| 292 virtual void Detach() OVERRIDE; | 292 virtual void Detach() override; |
| 293 virtual void SendMessageToBackend( | 293 virtual void SendMessageToBackend( |
| 294 const std::string& message) OVERRIDE; | 294 const std::string& message) override; |
| 295 virtual void OnSocketOpened() OVERRIDE; | 295 virtual void OnSocketOpened() override; |
| 296 virtual void OnFrameRead(const std::string& message) OVERRIDE; | 296 virtual void OnFrameRead(const std::string& message) override; |
| 297 virtual void OnSocketClosed() OVERRIDE; | 297 virtual void OnSocketClosed() override; |
| 298 | 298 |
| 299 const std::string id_; | 299 const std::string id_; |
| 300 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser_; | 300 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser_; |
| 301 const std::string debug_url_; | 301 const std::string debug_url_; |
| 302 bool socket_opened_; | 302 bool socket_opened_; |
| 303 bool is_web_view_; | 303 bool is_web_view_; |
| 304 std::vector<std::string> pending_messages_; | 304 std::vector<std::string> pending_messages_; |
| 305 scoped_ptr<DevToolsAndroidBridge::AndroidWebSocket> web_socket_; | 305 scoped_ptr<DevToolsAndroidBridge::AndroidWebSocket> web_socket_; |
| 306 content::DevToolsAgentHost* agent_host_; | 306 content::DevToolsAgentHost* agent_host_; |
| 307 content::DevToolsExternalAgentProxy* proxy_; | 307 content::DevToolsExternalAgentProxy* proxy_; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 //// RemotePageTarget ---------------------------------------------- | 384 //// RemotePageTarget ---------------------------------------------- |
| 385 | 385 |
| 386 class RemotePageTarget : public DevToolsTargetImpl, | 386 class RemotePageTarget : public DevToolsTargetImpl, |
| 387 public DevToolsAndroidBridge::RemotePage { | 387 public DevToolsAndroidBridge::RemotePage { |
| 388 public: | 388 public: |
| 389 RemotePageTarget(scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser, | 389 RemotePageTarget(scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser, |
| 390 const base::DictionaryValue& value); | 390 const base::DictionaryValue& value); |
| 391 virtual ~RemotePageTarget(); | 391 virtual ~RemotePageTarget(); |
| 392 | 392 |
| 393 // DevToolsAndroidBridge::RemotePage implementation. | 393 // DevToolsAndroidBridge::RemotePage implementation. |
| 394 virtual DevToolsTargetImpl* GetTarget() OVERRIDE; | 394 virtual DevToolsTargetImpl* GetTarget() override; |
| 395 virtual std::string GetFrontendURL() OVERRIDE; | 395 virtual std::string GetFrontendURL() override; |
| 396 | 396 |
| 397 // DevToolsTargetImpl overrides. | 397 // DevToolsTargetImpl overrides. |
| 398 virtual std::string GetId() const OVERRIDE; | 398 virtual std::string GetId() const override; |
| 399 virtual bool IsAttached() const OVERRIDE; | 399 virtual bool IsAttached() const override; |
| 400 virtual bool Activate() const OVERRIDE; | 400 virtual bool Activate() const override; |
| 401 virtual bool Close() const OVERRIDE; | 401 virtual bool Close() const override; |
| 402 virtual void Inspect(Profile* profile) const OVERRIDE; | 402 virtual void Inspect(Profile* profile) const override; |
| 403 virtual void Reload() const OVERRIDE; | 403 virtual void Reload() const override; |
| 404 | 404 |
| 405 void Navigate(const std::string& url, base::Closure callback) const; | 405 void Navigate(const std::string& url, base::Closure callback) const; |
| 406 | 406 |
| 407 private: | 407 private: |
| 408 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser_; | 408 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser_; |
| 409 std::string debug_url_; | 409 std::string debug_url_; |
| 410 std::string frontend_url_; | 410 std::string frontend_url_; |
| 411 std::string remote_id_; | 411 std::string remote_id_; |
| 412 std::string remote_type_; | 412 std::string remote_type_; |
| 413 std::string local_id_; | 413 std::string local_id_; |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 bool enabled; | 927 bool enabled; |
| 928 if (pref_value->GetAsBoolean(&enabled) && enabled) { | 928 if (pref_value->GetAsBoolean(&enabled) && enabled) { |
| 929 device_providers.push_back(new UsbDeviceProvider(profile_)); | 929 device_providers.push_back(new UsbDeviceProvider(profile_)); |
| 930 } | 930 } |
| 931 device_manager_->SetDeviceProviders(device_providers); | 931 device_manager_->SetDeviceProviders(device_providers); |
| 932 if (NeedsDeviceListPolling()) { | 932 if (NeedsDeviceListPolling()) { |
| 933 StopDeviceListPolling(); | 933 StopDeviceListPolling(); |
| 934 StartDeviceListPolling(); | 934 StartDeviceListPolling(); |
| 935 } | 935 } |
| 936 } | 936 } |
| OLD | NEW |