| 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 using CommandCallback = |
| 24 typedef base::Callback<void(int result, scoped_ptr<net::StreamSocket>)> | 24 base::Callback<void(int, const std::string&)>; |
| 25 SocketCallback; | 25 using SocketCallback = |
| 26 typedef base::Callback<void( | 26 base::Callback<void(int result, scoped_ptr<net::StreamSocket>)>; |
| 27 int result, const std::string& extensions, scoped_ptr<net::StreamSocket>)> | 27 // |body_head| should contain the body (WebSocket frame data) part that has |
| 28 HttpUpgradeCallback; | 28 // been read during processing the header (WebSocket handshake). |
| 29 typedef base::Callback<void(const std::vector<std::string>&)> SerialsCallback; | 29 using HttpUpgradeCallback = base::Callback<void( |
| 30 int result, |
| 31 const std::string& extensions, |
| 32 const std::string& body_head, |
| 33 scoped_ptr<net::StreamSocket>)>; |
| 34 using SerialsCallback = |
| 35 base::Callback<void(const std::vector<std::string>&)>; |
| 30 | 36 |
| 31 struct BrowserInfo { | 37 struct BrowserInfo { |
| 32 BrowserInfo(); | 38 BrowserInfo(); |
| 33 | 39 |
| 34 enum Type { | 40 enum Type { |
| 35 kTypeChrome, | 41 kTypeChrome, |
| 36 kTypeWebView, | 42 kTypeWebView, |
| 37 kTypeOther | 43 kTypeOther |
| 38 }; | 44 }; |
| 39 | 45 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 friend class Device; | 82 friend class Device; |
| 77 class WebSocketImpl; | 83 class WebSocketImpl; |
| 78 | 84 |
| 79 AndroidWebSocket( | 85 AndroidWebSocket( |
| 80 scoped_refptr<Device> device, | 86 scoped_refptr<Device> device, |
| 81 const std::string& socket_name, | 87 const std::string& socket_name, |
| 82 const std::string& url, | 88 const std::string& url, |
| 83 AndroidWebSocket::Delegate* delegate); | 89 AndroidWebSocket::Delegate* delegate); |
| 84 void Connected(int result, | 90 void Connected(int result, |
| 85 const std::string& extensions, | 91 const std::string& extensions, |
| 92 const std::string& body_head, |
| 86 scoped_ptr<net::StreamSocket> socket); | 93 scoped_ptr<net::StreamSocket> socket); |
| 87 void OnFrameRead(const std::string& message); | 94 void OnFrameRead(const std::string& message); |
| 88 void OnSocketClosed(); | 95 void OnSocketClosed(); |
| 89 void Terminate(); | 96 void Terminate(); |
| 90 | 97 |
| 91 Device* device_; | 98 Device* device_; |
| 92 WebSocketImpl* socket_impl_; | 99 WebSocketImpl* socket_impl_; |
| 93 Delegate* delegate_; | 100 Delegate* delegate_; |
| 94 base::WeakPtrFactory<AndroidWebSocket> weak_factory_; | 101 base::WeakPtrFactory<AndroidWebSocket> weak_factory_; |
| 95 DISALLOW_COPY_AND_ASSIGN(AndroidWebSocket); | 102 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; | 237 typedef std::map<std::string, base::WeakPtr<Device> > DeviceWeakMap; |
| 231 | 238 |
| 232 scoped_refptr<HandlerThread> handler_thread_; | 239 scoped_refptr<HandlerThread> handler_thread_; |
| 233 DeviceProviders providers_; | 240 DeviceProviders providers_; |
| 234 DeviceWeakMap devices_; | 241 DeviceWeakMap devices_; |
| 235 | 242 |
| 236 base::WeakPtrFactory<AndroidDeviceManager> weak_factory_; | 243 base::WeakPtrFactory<AndroidDeviceManager> weak_factory_; |
| 237 }; | 244 }; |
| 238 | 245 |
| 239 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ | 246 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ |
| OLD | NEW |