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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 : public AndroidDeviceManager::AndroidWebSocket::Delegate { | 187 : public AndroidDeviceManager::AndroidWebSocket::Delegate { |
188 public: | 188 public: |
189 ProtocolCommand( | 189 ProtocolCommand( |
190 scoped_refptr<AndroidDeviceManager::Device> device, | 190 scoped_refptr<AndroidDeviceManager::Device> device, |
191 const std::string& socket, | 191 const std::string& socket, |
192 const std::string& debug_url, | 192 const std::string& debug_url, |
193 const std::string& command, | 193 const std::string& command, |
194 const base::Closure callback); | 194 const base::Closure callback); |
195 | 195 |
196 private: | 196 private: |
197 virtual void OnSocketOpened() override; | 197 void OnSocketOpened() override; |
198 virtual void OnFrameRead(const std::string& message) override; | 198 void OnFrameRead(const std::string& message) override; |
199 virtual void OnSocketClosed() override; | 199 void OnSocketClosed() override; |
200 virtual ~ProtocolCommand(); | 200 ~ProtocolCommand() override; |
201 | 201 |
202 const std::string command_; | 202 const std::string command_; |
203 const base::Closure callback_; | 203 const base::Closure callback_; |
204 scoped_ptr<AndroidDeviceManager::AndroidWebSocket> web_socket_; | 204 scoped_ptr<AndroidDeviceManager::AndroidWebSocket> web_socket_; |
205 | 205 |
206 DISALLOW_COPY_AND_ASSIGN(ProtocolCommand); | 206 DISALLOW_COPY_AND_ASSIGN(ProtocolCommand); |
207 }; | 207 }; |
208 | 208 |
209 ProtocolCommand::ProtocolCommand( | 209 ProtocolCommand::ProtocolCommand( |
210 scoped_refptr<AndroidDeviceManager::Device> device, | 210 scoped_refptr<AndroidDeviceManager::Device> device, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 const std::string& debug_url, | 286 const std::string& debug_url, |
287 bool is_web_view); | 287 bool is_web_view); |
288 | 288 |
289 private: | 289 private: |
290 AgentHostDelegate( | 290 AgentHostDelegate( |
291 scoped_refptr<DevToolsAndroidBridge> bridge, | 291 scoped_refptr<DevToolsAndroidBridge> bridge, |
292 const std::string& id, | 292 const std::string& id, |
293 const BrowserId& browser_id, | 293 const BrowserId& browser_id, |
294 const std::string& debug_url, | 294 const std::string& debug_url, |
295 bool is_web_view); | 295 bool is_web_view); |
296 virtual ~AgentHostDelegate(); | 296 ~AgentHostDelegate() override; |
297 virtual void Attach(content::DevToolsExternalAgentProxy* proxy) override; | 297 void Attach(content::DevToolsExternalAgentProxy* proxy) override; |
298 virtual void Detach() override; | 298 void Detach() override; |
299 virtual void SendMessageToBackend( | 299 void SendMessageToBackend(const std::string& message) override; |
300 const std::string& message) override; | 300 void OnSocketOpened() override; |
301 virtual void OnSocketOpened() override; | 301 void OnFrameRead(const std::string& message) override; |
302 virtual void OnFrameRead(const std::string& message) override; | 302 void OnSocketClosed() override; |
303 virtual void OnSocketClosed() override; | |
304 | 303 |
305 std::string id_; | 304 std::string id_; |
306 scoped_refptr<DevToolsAndroidBridge> bridge_; | 305 scoped_refptr<DevToolsAndroidBridge> bridge_; |
307 BrowserId browser_id_; | 306 BrowserId browser_id_; |
308 std::string debug_url_; | 307 std::string debug_url_; |
309 bool socket_opened_; | 308 bool socket_opened_; |
310 bool is_web_view_; | 309 bool is_web_view_; |
311 std::vector<std::string> pending_messages_; | 310 std::vector<std::string> pending_messages_; |
312 scoped_ptr<AndroidDeviceManager::AndroidWebSocket> web_socket_; | 311 scoped_ptr<AndroidDeviceManager::AndroidWebSocket> web_socket_; |
313 content::DevToolsAgentHost* agent_host_; | 312 content::DevToolsAgentHost* agent_host_; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 } | 398 } |
400 | 399 |
401 //// RemotePageTarget ---------------------------------------------- | 400 //// RemotePageTarget ---------------------------------------------- |
402 | 401 |
403 class DevToolsAndroidBridge::RemotePageTarget : public DevToolsTargetImpl { | 402 class DevToolsAndroidBridge::RemotePageTarget : public DevToolsTargetImpl { |
404 public: | 403 public: |
405 RemotePageTarget(scoped_refptr<DevToolsAndroidBridge> bridge, | 404 RemotePageTarget(scoped_refptr<DevToolsAndroidBridge> bridge, |
406 const BrowserId& browser_id, | 405 const BrowserId& browser_id, |
407 const base::DictionaryValue& value, | 406 const base::DictionaryValue& value, |
408 bool is_web_view_); | 407 bool is_web_view_); |
409 virtual ~RemotePageTarget(); | 408 ~RemotePageTarget() override; |
410 | 409 |
411 // DevToolsTargetImpl overrides. | 410 // DevToolsTargetImpl overrides. |
412 virtual std::string GetId() const override; | 411 std::string GetId() const override; |
413 virtual bool IsAttached() const override; | 412 bool IsAttached() const override; |
414 virtual bool Activate() const override; | 413 bool Activate() const override; |
415 virtual bool Close() const override; | 414 bool Close() const override; |
416 virtual void Inspect(Profile* profile) const override; | 415 void Inspect(Profile* profile) const override; |
417 virtual void Reload() const override; | 416 void Reload() const override; |
418 | 417 |
419 void Navigate(const std::string& url, base::Closure callback) const; | 418 void Navigate(const std::string& url, base::Closure callback) const; |
420 | 419 |
421 private: | 420 private: |
422 scoped_refptr<DevToolsAndroidBridge> bridge_; | 421 scoped_refptr<DevToolsAndroidBridge> bridge_; |
423 BrowserId browser_id_; | 422 BrowserId browser_id_; |
424 std::string debug_url_; | 423 std::string debug_url_; |
425 std::string frontend_url_; | 424 std::string frontend_url_; |
426 std::string remote_id_; | 425 std::string remote_id_; |
427 std::string remote_type_; | 426 std::string remote_type_; |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 bool enabled; | 960 bool enabled; |
962 if (pref_value->GetAsBoolean(&enabled) && enabled) { | 961 if (pref_value->GetAsBoolean(&enabled) && enabled) { |
963 device_providers.push_back(new UsbDeviceProvider(profile_)); | 962 device_providers.push_back(new UsbDeviceProvider(profile_)); |
964 } | 963 } |
965 device_manager_->SetDeviceProviders(device_providers); | 964 device_manager_->SetDeviceProviders(device_providers); |
966 if (NeedsDeviceListPolling()) { | 965 if (NeedsDeviceListPolling()) { |
967 StopDeviceListPolling(); | 966 StopDeviceListPolling(); |
968 StartDeviceListPolling(); | 967 StartDeviceListPolling(); |
969 } | 968 } |
970 } | 969 } |
OLD | NEW |