| 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" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 class StreamSocket; | 18 class StreamSocket; |
| 19 } | 19 } |
| 20 | 20 |
| 21 class AndroidDeviceManager : public base::NonThreadSafe { | 21 class AndroidDeviceManager : public base::NonThreadSafe { |
| 22 public: | 22 public: |
| 23 typedef base::Callback<void(int, const std::string&)> CommandCallback; | 23 typedef base::Callback<void(int, const std::string&)> CommandCallback; |
| 24 typedef base::Callback<void(int result, scoped_ptr<net::StreamSocket>)> | 24 typedef base::Callback<void(int result, scoped_ptr<net::StreamSocket>)> |
| 25 SocketCallback; | 25 SocketCallback; |
| 26 typedef base::Callback<void( | 26 typedef base::Callback<void(int result, |
| 27 int result, const std::string& extensions, scoped_ptr<net::StreamSocket>)> | 27 const std::string& extensions, |
| 28 const std::string& leading_bytes, |
| 29 scoped_ptr<net::StreamSocket>)> |
| 28 HttpUpgradeCallback; | 30 HttpUpgradeCallback; |
| 29 typedef base::Callback<void(const std::vector<std::string>&)> SerialsCallback; | 31 typedef base::Callback<void(const std::vector<std::string>&)> SerialsCallback; |
| 30 | 32 |
| 31 struct BrowserInfo { | 33 struct BrowserInfo { |
| 32 BrowserInfo(); | 34 BrowserInfo(); |
| 33 | 35 |
| 34 enum Type { | 36 enum Type { |
| 35 kTypeChrome, | 37 kTypeChrome, |
| 36 kTypeWebView, | 38 kTypeWebView, |
| 37 kTypeOther | 39 kTypeOther |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 friend class Device; | 78 friend class Device; |
| 77 class WebSocketImpl; | 79 class WebSocketImpl; |
| 78 | 80 |
| 79 AndroidWebSocket( | 81 AndroidWebSocket( |
| 80 scoped_refptr<Device> device, | 82 scoped_refptr<Device> device, |
| 81 const std::string& socket_name, | 83 const std::string& socket_name, |
| 82 const std::string& url, | 84 const std::string& url, |
| 83 AndroidWebSocket::Delegate* delegate); | 85 AndroidWebSocket::Delegate* delegate); |
| 84 void Connected(int result, | 86 void Connected(int result, |
| 85 const std::string& extensions, | 87 const std::string& extensions, |
| 88 const std::string& leading_bytes, |
| 86 scoped_ptr<net::StreamSocket> socket); | 89 scoped_ptr<net::StreamSocket> socket); |
| 87 void OnFrameRead(const std::string& message); | 90 void OnFrameRead(const std::string& message); |
| 88 void OnSocketClosed(); | 91 void OnSocketClosed(); |
| 89 void Terminate(); | 92 void Terminate(); |
| 90 | 93 |
| 91 Device* device_; | 94 Device* device_; |
| 92 WebSocketImpl* socket_impl_; | 95 WebSocketImpl* socket_impl_; |
| 93 Delegate* delegate_; | 96 Delegate* delegate_; |
| 94 base::WeakPtrFactory<AndroidWebSocket> weak_factory_; | 97 base::WeakPtrFactory<AndroidWebSocket> weak_factory_; |
| 95 DISALLOW_COPY_AND_ASSIGN(AndroidWebSocket); | 98 DISALLOW_COPY_AND_ASSIGN(AndroidWebSocket); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 typedef std::map<std::string, base::WeakPtr<Device> > DeviceWeakMap; | 233 typedef std::map<std::string, base::WeakPtr<Device> > DeviceWeakMap; |
| 231 | 234 |
| 232 scoped_refptr<HandlerThread> handler_thread_; | 235 scoped_refptr<HandlerThread> handler_thread_; |
| 233 DeviceProviders providers_; | 236 DeviceProviders providers_; |
| 234 DeviceWeakMap devices_; | 237 DeviceWeakMap devices_; |
| 235 | 238 |
| 236 base::WeakPtrFactory<AndroidDeviceManager> weak_factory_; | 239 base::WeakPtrFactory<AndroidDeviceManager> weak_factory_; |
| 237 }; | 240 }; |
| 238 | 241 |
| 239 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ | 242 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ |
| OLD | NEW |