| Index: chrome/browser/devtools/device/devtools_android_bridge.h
|
| diff --git a/chrome/browser/devtools/device/devtools_android_bridge.h b/chrome/browser/devtools/device/devtools_android_bridge.h
|
| index ca6102b118910122a58544f7a05bb4e23aaf16f8..35faeed807f110bf92bfec79d98dadff51c42d41 100644
|
| --- a/chrome/browser/devtools/device/devtools_android_bridge.h
|
| +++ b/chrome/browser/devtools/device/devtools_android_bridge.h
|
| @@ -15,6 +15,7 @@
|
| #include "base/memory/ref_counted.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "chrome/browser/devtools/device/android_device_manager.h"
|
| +#include "chrome/browser/devtools/device/devtools_device_discovery.h"
|
| #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
|
| #include "components/keyed_service/core/keyed_service.h"
|
| #include "components/prefs/pref_change_registrar.h"
|
| @@ -60,99 +61,18 @@ class DevToolsAndroidBridge : public KeyedService {
|
| DISALLOW_COPY_AND_ASSIGN(Factory);
|
| };
|
|
|
| - class RemotePage : public base::RefCounted<RemotePage> {
|
| - public:
|
| - scoped_refptr<AndroidDeviceManager::Device> device() { return device_; }
|
| - const std::string& socket() { return browser_id_; }
|
| - const std::string& frontend_url() { return frontend_url_; }
|
| - scoped_refptr<content::DevToolsAgentHost> CreateTarget();
|
| -
|
| - private:
|
| - friend class base::RefCounted<RemotePage>;
|
| - friend class DevToolsAndroidBridge;
|
| -
|
| - RemotePage(scoped_refptr<AndroidDeviceManager::Device> device,
|
| - const std::string& browser_id,
|
| - const base::DictionaryValue& dict);
|
| -
|
| - virtual ~RemotePage();
|
| + using RemotePage = DevToolsDeviceDiscovery::RemotePage;
|
| + using RemotePages = DevToolsDeviceDiscovery::RemotePages;
|
| + using RemoteBrowser = DevToolsDeviceDiscovery::RemoteBrowser;
|
| + using RemoteBrowsers = DevToolsDeviceDiscovery::RemoteBrowsers;
|
| + using RemoteDevice = DevToolsDeviceDiscovery::RemoteDevice;
|
| + using RemoteDevices = DevToolsDeviceDiscovery::RemoteDevices;
|
| + using CompleteDevice = DevToolsDeviceDiscovery::CompleteDevice;
|
| + using CompleteDevices = DevToolsDeviceDiscovery::CompleteDevices;
|
| + using DeviceListCallback = DevToolsDeviceDiscovery::DeviceListCallback;
|
|
|
| - scoped_refptr<AndroidDeviceManager::Device> device_;
|
| - std::string browser_id_;
|
| - std::string frontend_url_;
|
| - std::unique_ptr<base::DictionaryValue> dict_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(RemotePage);
|
| - };
|
| -
|
| - using RemotePages = std::vector<scoped_refptr<RemotePage> >;
|
| using JsonRequestCallback = base::Callback<void(int, const std::string&)>;
|
|
|
| - class RemoteBrowser : public base::RefCounted<RemoteBrowser> {
|
| - public:
|
| - const std::string& serial() { return serial_; }
|
| - const std::string& socket() { return browser_id_; }
|
| - const std::string& display_name() { return display_name_; }
|
| - const std::string& user() { return user_; }
|
| - const std::string& version() { return version_; }
|
| - const RemotePages& pages() { return pages_; }
|
| -
|
| - bool IsChrome();
|
| - std::string GetId();
|
| -
|
| - using ParsedVersion = std::vector<int>;
|
| - ParsedVersion GetParsedVersion();
|
| -
|
| - private:
|
| - friend class base::RefCounted<RemoteBrowser>;
|
| - friend class DevToolsAndroidBridge;
|
| -
|
| - RemoteBrowser(const std::string& serial,
|
| - const AndroidDeviceManager::BrowserInfo& browser_info);
|
| -
|
| - virtual ~RemoteBrowser();
|
| -
|
| - std::string serial_;
|
| - std::string browser_id_;
|
| - std::string display_name_;
|
| - std::string user_;
|
| - AndroidDeviceManager::BrowserInfo::Type type_;
|
| - std::string version_;
|
| - RemotePages pages_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(RemoteBrowser);
|
| - };
|
| -
|
| - using RemoteBrowsers = std::vector<scoped_refptr<RemoteBrowser> >;
|
| -
|
| - class RemoteDevice : public base::RefCounted<RemoteDevice> {
|
| - public:
|
| - std::string serial() { return serial_; }
|
| - std::string model() { return model_; }
|
| - bool is_connected() { return connected_; }
|
| - RemoteBrowsers& browsers() { return browsers_; }
|
| - gfx::Size screen_size() { return screen_size_; }
|
| -
|
| - private:
|
| - friend class base::RefCounted<RemoteDevice>;
|
| - friend class DevToolsAndroidBridge;
|
| -
|
| - RemoteDevice(const std::string& serial,
|
| - const AndroidDeviceManager::DeviceInfo& device_info);
|
| -
|
| - virtual ~RemoteDevice();
|
| -
|
| - std::string serial_;
|
| - std::string model_;
|
| - bool connected_;
|
| - RemoteBrowsers browsers_;
|
| - gfx::Size screen_size_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(RemoteDevice);
|
| - };
|
| -
|
| - using RemoteDevices = std::vector<scoped_refptr<RemoteDevice> >;
|
| -
|
| class DeviceListListener {
|
| public:
|
| virtual void DeviceListChanged(const RemoteDevices& devices) = 0;
|
| @@ -190,15 +110,6 @@ class DevToolsAndroidBridge : public KeyedService {
|
| virtual ~PortForwardingListener() {}
|
| };
|
|
|
| - using CompleteDevice = std::pair<scoped_refptr<AndroidDeviceManager::Device>,
|
| - scoped_refptr<RemoteDevice>>;
|
| - using CompleteDevices = std::vector<CompleteDevice>;
|
| - using DeviceListCallback = base::Callback<void(const CompleteDevices&)>;
|
| -
|
| - static void QueryCompleteDevices(
|
| - AndroidDeviceManager* device_manager,
|
| - const DeviceListCallback& callback);
|
| -
|
| void AddPortForwardingListener(PortForwardingListener* listener);
|
| void RemovePortForwardingListener(PortForwardingListener* listener);
|
|
|
| @@ -232,10 +143,6 @@ class DevToolsAndroidBridge : public KeyedService {
|
| content::BrowserThread::UI>;
|
| friend class base::DeleteHelper<DevToolsAndroidBridge>;
|
|
|
| - class AgentHostDelegate;
|
| - class DiscoveryRequest;
|
| - class RemotePageTarget;
|
| -
|
| ~DevToolsAndroidBridge() override;
|
|
|
| void StartDeviceListPolling();
|
| @@ -267,7 +174,6 @@ class DevToolsAndroidBridge : public KeyedService {
|
|
|
| using DeviceListListeners = std::vector<DeviceListListener*>;
|
| DeviceListListeners device_list_listeners_;
|
| - base::CancelableCallback<void(const CompleteDevices&)> device_list_callback_;
|
|
|
| using DeviceCountListeners = std::vector<DeviceCountListener*>;
|
| DeviceCountListeners device_count_listeners_;
|
| @@ -282,6 +188,8 @@ class DevToolsAndroidBridge : public KeyedService {
|
|
|
| TCPProviderCallback tcp_provider_callback_;
|
|
|
| + std::unique_ptr<DevToolsDeviceDiscovery> device_discovery_;
|
| +
|
| base::WeakPtrFactory<DevToolsAndroidBridge> weak_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(DevToolsAndroidBridge);
|
|
|