| 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 #ifndef CHROME_BROWSER_DEVTOOLS_CHROME_DEVTOOLS_MANAGER_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_CHROME_DEVTOOLS_MANAGER_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_DEVTOOLS_CHROME_DEVTOOLS_MANAGER_DELEGATE_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_CHROME_DEVTOOLS_MANAGER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | |
| 12 | 11 |
| 13 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 14 #include "base/macros.h" | 13 #include "base/macros.h" |
| 15 #include "chrome/browser/devtools/device/devtools_device_discovery.h" | 14 #include "chrome/browser/devtools/device/devtools_device_discovery.h" |
| 16 #include "content/public/browser/devtools_agent_host_observer.h" | 15 #include "content/public/browser/devtools_agent_host_observer.h" |
| 17 #include "content/public/browser/devtools_manager_delegate.h" | 16 #include "content/public/browser/devtools_manager_delegate.h" |
| 18 #include "net/base/host_port_pair.h" | 17 #include "net/base/host_port_pair.h" |
| 19 | 18 |
| 20 class DevToolsNetworkProtocolHandler; | 19 class DevToolsNetworkProtocolHandler; |
| 21 | 20 |
| 22 class ChromeDevToolsManagerDelegate : | 21 class ChromeDevToolsManagerDelegate : |
| 23 public content::DevToolsManagerDelegate, | 22 public content::DevToolsManagerDelegate, |
| 24 public content::DevToolsAgentHostObserver { | 23 public content::DevToolsAgentHostObserver { |
| 25 public: | 24 public: |
| 26 static char kTypeApp[]; | 25 static char kTypeApp[]; |
| 27 static char kTypeBackgroundPage[]; | 26 static char kTypeBackgroundPage[]; |
| 28 static char kTypeWebView[]; | 27 static char kTypeWebView[]; |
| 29 | 28 |
| 30 ChromeDevToolsManagerDelegate(); | 29 ChromeDevToolsManagerDelegate(); |
| 31 ~ChromeDevToolsManagerDelegate() override; | 30 ~ChromeDevToolsManagerDelegate() override; |
| 32 | 31 |
| 33 private: | 32 private: |
| 34 class HostData; | 33 class HostData; |
| 35 friend class DevToolsManagerDelegateTest; | |
| 36 using RemoteLocations = std::set<net::HostPortPair>; | 34 using RemoteLocations = std::set<net::HostPortPair>; |
| 37 | 35 |
| 38 // content::DevToolsManagerDelegate implementation. | 36 // content::DevToolsManagerDelegate implementation. |
| 39 void Inspect(content::DevToolsAgentHost* agent_host) override; | 37 void Inspect(content::DevToolsAgentHost* agent_host) override; |
| 40 base::DictionaryValue* HandleCommand( | 38 base::DictionaryValue* HandleCommand( |
| 41 content::DevToolsAgentHost* agent_host, | 39 content::DevToolsAgentHost* agent_host, |
| 42 base::DictionaryValue* command_dict) override; | 40 base::DictionaryValue* command_dict) override; |
| 43 std::string GetTargetType(content::RenderFrameHost* host) override; | 41 std::string GetTargetType(content::RenderFrameHost* host) override; |
| 44 std::string GetTargetTitle(content::RenderFrameHost* host) override; | 42 std::string GetTargetTitle(content::RenderFrameHost* host) override; |
| 45 scoped_refptr<content::DevToolsAgentHost> CreateNewTarget( | 43 scoped_refptr<content::DevToolsAgentHost> CreateNewTarget( |
| 46 const GURL& url) override; | 44 const GURL& url) override; |
| 47 std::string GetDiscoveryPageHTML() override; | 45 std::string GetDiscoveryPageHTML() override; |
| 48 std::string GetFrontendResource(const std::string& path) override; | 46 std::string GetFrontendResource(const std::string& path) override; |
| 49 | 47 |
| 50 // content::DevToolsAgentHostObserver overrides. | 48 // content::DevToolsAgentHostObserver overrides. |
| 51 void DevToolsAgentHostAttached( | 49 void DevToolsAgentHostAttached( |
| 52 content::DevToolsAgentHost* agent_host) override; | 50 content::DevToolsAgentHost* agent_host) override; |
| 53 void DevToolsAgentHostDetached( | 51 void DevToolsAgentHostDetached( |
| 54 content::DevToolsAgentHost* agent_host) override; | 52 content::DevToolsAgentHost* agent_host) override; |
| 55 | 53 |
| 56 void UpdateDeviceDiscovery(); | 54 void UpdateDeviceDiscovery(); |
| 57 void DevicesAvailable( | 55 void DevicesAvailable( |
| 58 const DevToolsDeviceDiscovery::CompleteDevices& devices); | 56 const DevToolsDeviceDiscovery::CompleteDevices& devices); |
| 59 | 57 |
| 60 std::unique_ptr<base::DictionaryValue> SetRemoteLocations( | 58 std::unique_ptr<base::DictionaryValue> SetRemoteLocations( |
| 61 content::DevToolsAgentHost* agent_host, | 59 content::DevToolsAgentHost* agent_host, |
| 62 int command_id, | 60 int command_id, |
| 63 base::DictionaryValue* params); | 61 base::DictionaryValue* params); |
| 64 | 62 |
| 65 std::unique_ptr<base::DictionaryValue> HandleBrowserCommand( | |
| 66 int id, | |
| 67 std::string method, | |
| 68 base::DictionaryValue* params); | |
| 69 static std::unique_ptr<base::DictionaryValue> GetWindowForTarget( | |
| 70 int id, | |
| 71 base::DictionaryValue* params); | |
| 72 static std::unique_ptr<base::DictionaryValue> GetWindowBounds( | |
| 73 int id, | |
| 74 base::DictionaryValue* params); | |
| 75 static std::unique_ptr<base::DictionaryValue> SetWindowBounds( | |
| 76 int id, | |
| 77 base::DictionaryValue* params); | |
| 78 | |
| 79 std::unique_ptr<DevToolsNetworkProtocolHandler> network_protocol_handler_; | 63 std::unique_ptr<DevToolsNetworkProtocolHandler> network_protocol_handler_; |
| 80 std::map<content::DevToolsAgentHost*, std::unique_ptr<HostData>> host_data_; | 64 std::map<content::DevToolsAgentHost*, std::unique_ptr<HostData>> host_data_; |
| 81 | 65 |
| 82 std::unique_ptr<AndroidDeviceManager> device_manager_; | 66 std::unique_ptr<AndroidDeviceManager> device_manager_; |
| 83 std::unique_ptr<DevToolsDeviceDiscovery> device_discovery_; | 67 std::unique_ptr<DevToolsDeviceDiscovery> device_discovery_; |
| 84 content::DevToolsAgentHost::List remote_agent_hosts_; | 68 content::DevToolsAgentHost::List remote_agent_hosts_; |
| 85 RemoteLocations remote_locations_; | 69 RemoteLocations remote_locations_; |
| 86 | 70 |
| 87 DISALLOW_COPY_AND_ASSIGN(ChromeDevToolsManagerDelegate); | 71 DISALLOW_COPY_AND_ASSIGN(ChromeDevToolsManagerDelegate); |
| 88 }; | 72 }; |
| 89 | 73 |
| 90 #endif // CHROME_BROWSER_DEVTOOLS_CHROME_DEVTOOLS_MANAGER_DELEGATE_H_ | 74 #endif // CHROME_BROWSER_DEVTOOLS_CHROME_DEVTOOLS_MANAGER_DELEGATE_H_ |
| OLD | NEW |