| 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 d35f8e1c91b166f5e1f370cf88243b1da2417951..4dc7bc303933462125aab781256a1167d51c1800 100644
|
| --- a/chrome/browser/devtools/device/devtools_android_bridge.h
|
| +++ b/chrome/browser/devtools/device/devtools_android_bridge.h
|
| @@ -107,14 +107,32 @@ class DevToolsAndroidBridge
|
|
|
| typedef base::Callback<void(RemotePage*)> RemotePageCallback;
|
|
|
| + class DeviceHandle : public base::RefCounted<DeviceHandle> {
|
| + public:
|
| + DeviceHandle(scoped_refptr<DevToolsAndroidBridge> android_bridge,
|
| + const std::string& serial);
|
| +
|
| + std::string serial() const { return serial_; }
|
| + DevToolsAndroidBridge* android_bridge() const {
|
| + return android_bridge_.get();
|
| + }
|
| + private:
|
| + friend class base::RefCounted<DeviceHandle>;
|
| + virtual ~DeviceHandle();
|
| +
|
| + scoped_refptr<DevToolsAndroidBridge> android_bridge_;
|
| + const std::string serial_;
|
| + };
|
| +
|
| + typedef std::map<std::string, scoped_refptr<DeviceHandle> > DeviceHandleMap;
|
| +
|
| class RemoteBrowser : public base::RefCounted<RemoteBrowser> {
|
| public:
|
| RemoteBrowser(
|
| - scoped_refptr<DevToolsAndroidBridge> android_bridge,
|
| - const std::string& serial,
|
| + scoped_refptr<DeviceHandle> device_handle,
|
| const std::string& socket);
|
|
|
| - std::string serial() { return serial_; }
|
| + std::string serial() { return device_handle_->serial(); }
|
| std::string socket() { return socket_; }
|
|
|
| std::string display_name() { return display_name_; }
|
| @@ -167,8 +185,7 @@ class DevToolsAndroidBridge
|
| int result,
|
| const std::string& response);
|
|
|
| - scoped_refptr<DevToolsAndroidBridge> android_bridge_;
|
| - const std::string serial_;
|
| + scoped_refptr<DeviceHandle> device_handle_;
|
| const std::string socket_;
|
| std::string display_name_;
|
| std::string version_;
|
| @@ -181,12 +198,11 @@ class DevToolsAndroidBridge
|
|
|
| class RemoteDevice : public base::RefCounted<RemoteDevice> {
|
| public:
|
| - RemoteDevice(scoped_refptr<DevToolsAndroidBridge> android_bridge,
|
| - const std::string& serial,
|
| + RemoteDevice(scoped_refptr<DeviceHandle> device_handle,
|
| const std::string& model,
|
| bool connected);
|
|
|
| - std::string serial() { return serial_; }
|
| + std::string serial() { return device_handle_->serial(); }
|
| std::string model() { return model_; }
|
| bool is_connected() { return connected_; }
|
| void AddBrowser(scoped_refptr<RemoteBrowser> browser);
|
| @@ -202,8 +218,7 @@ class DevToolsAndroidBridge
|
| friend class base::RefCounted<RemoteDevice>;
|
| virtual ~RemoteDevice();
|
|
|
| - scoped_refptr<DevToolsAndroidBridge> android_bridge_;
|
| - std::string serial_;
|
| + scoped_refptr<DeviceHandle> device_handle_;
|
| std::string model_;
|
| bool connected_;
|
| RemoteBrowsers browsers_;
|
| @@ -242,6 +257,9 @@ class DevToolsAndroidBridge
|
|
|
| static bool HasDevToolsWindow(const std::string& agent_id);
|
|
|
| + void IsConnectedForTest(const std::string& serial,
|
| + const base::Callback<void(bool)>& callback);
|
| +
|
| private:
|
| friend struct content::BrowserThread::DeleteOnThread<
|
| content::BrowserThread::UI>;
|
| @@ -274,7 +292,8 @@ class DevToolsAndroidBridge
|
|
|
| void CreatedDeviceManager(scoped_refptr<AndroidDeviceManager> device_manager);
|
| void RequestDeviceList();
|
| - void ReceivedDeviceList(RemoteDevices* devices);
|
| + void ReceivedDeviceList(RemoteDevices* devices,
|
| + DeviceHandleMap* device_handles);
|
|
|
| void RequestDeviceCount();
|
| void ReceivedDeviceCount(int count);
|
| @@ -287,6 +306,7 @@ class DevToolsAndroidBridge
|
|
|
| typedef std::vector<DeviceListListener*> DeviceListListeners;
|
| DeviceListListeners device_list_listeners_;
|
| + DeviceHandleMap device_handles_;
|
|
|
| typedef std::vector<DeviceCountListener*> DeviceCountListeners;
|
| DeviceCountListeners device_count_listeners_;
|
|
|