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