| 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_DEVICE_ANDROID_DEVICE_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ |
| 6 #define CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 class WebSocketImpl; | 76 class WebSocketImpl; |
| 77 | 77 |
| 78 AndroidWebSocket( | 78 AndroidWebSocket( |
| 79 scoped_refptr<Device> device, | 79 scoped_refptr<Device> device, |
| 80 const std::string& socket_name, | 80 const std::string& socket_name, |
| 81 const std::string& url, | 81 const std::string& url, |
| 82 AndroidWebSocket::Delegate* delegate); | 82 AndroidWebSocket::Delegate* delegate); |
| 83 void Connected(int result, scoped_ptr<net::StreamSocket> socket); | 83 void Connected(int result, scoped_ptr<net::StreamSocket> socket); |
| 84 void OnFrameRead(const std::string& message); | 84 void OnFrameRead(const std::string& message); |
| 85 void OnSocketClosed(); | 85 void OnSocketClosed(); |
| 86 void Terminate(); |
| 86 | 87 |
| 87 scoped_refptr<Device> device_; | 88 Device* device_; |
| 88 std::string url_; | 89 std::string url_; |
| 89 WebSocketImpl* socket_impl_; | 90 WebSocketImpl* socket_impl_; |
| 90 Delegate* delegate_; | 91 Delegate* delegate_; |
| 91 base::WeakPtrFactory<AndroidWebSocket> weak_factory_; | 92 base::WeakPtrFactory<AndroidWebSocket> weak_factory_; |
| 92 DISALLOW_COPY_AND_ASSIGN(AndroidWebSocket); | 93 DISALLOW_COPY_AND_ASSIGN(AndroidWebSocket); |
| 93 }; | 94 }; |
| 94 | 95 |
| 95 class DeviceProvider; | 96 class DeviceProvider; |
| 96 | 97 |
| 97 class Device : public base::RefCountedThreadSafe<Device>, | 98 class Device : public base::RefCountedThreadSafe<Device>, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 123 | 124 |
| 124 Device(scoped_refptr<base::MessageLoopProxy> device_message_loop, | 125 Device(scoped_refptr<base::MessageLoopProxy> device_message_loop, |
| 125 scoped_refptr<DeviceProvider> provider, | 126 scoped_refptr<DeviceProvider> provider, |
| 126 const std::string& serial); | 127 const std::string& serial); |
| 127 | 128 |
| 128 virtual ~Device(); | 129 virtual ~Device(); |
| 129 | 130 |
| 130 scoped_refptr<base::MessageLoopProxy> device_message_loop_; | 131 scoped_refptr<base::MessageLoopProxy> device_message_loop_; |
| 131 scoped_refptr<DeviceProvider> provider_; | 132 scoped_refptr<DeviceProvider> provider_; |
| 132 std::string serial_; | 133 std::string serial_; |
| 134 std::set<AndroidWebSocket*> sockets_; |
| 133 base::WeakPtrFactory<Device> weak_factory_; | 135 base::WeakPtrFactory<Device> weak_factory_; |
| 134 | 136 |
| 135 DISALLOW_COPY_AND_ASSIGN(Device); | 137 DISALLOW_COPY_AND_ASSIGN(Device); |
| 136 }; | 138 }; |
| 137 | 139 |
| 138 typedef std::vector<scoped_refptr<Device> > Devices; | 140 typedef std::vector<scoped_refptr<Device> > Devices; |
| 139 typedef base::Callback<void(const Devices&)> DevicesCallback; | 141 typedef base::Callback<void(const Devices&)> DevicesCallback; |
| 140 | 142 |
| 141 class DeviceProvider : public base::RefCountedThreadSafe<DeviceProvider> { | 143 class DeviceProvider : public base::RefCountedThreadSafe<DeviceProvider> { |
| 142 public: | 144 public: |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 DeviceDescriptors* descriptors); | 218 DeviceDescriptors* descriptors); |
| 217 | 219 |
| 218 typedef std::map<std::string, base::WeakPtr<Device> > DeviceWeakMap; | 220 typedef std::map<std::string, base::WeakPtr<Device> > DeviceWeakMap; |
| 219 | 221 |
| 220 scoped_refptr<HandlerThread> handler_thread_; | 222 scoped_refptr<HandlerThread> handler_thread_; |
| 221 DeviceProviders providers_; | 223 DeviceProviders providers_; |
| 222 DeviceWeakMap devices_; | 224 DeviceWeakMap devices_; |
| 223 }; | 225 }; |
| 224 | 226 |
| 225 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ | 227 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ |
| OLD | NEW |