Chromium Code Reviews| 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( |
|
dgozman
2015/04/09 14:05:22
nit: while you are here, please move from "typedef
tyoshino (SeeGerritForStatus)
2015/04/14 12:24:33
Done.
| |
| 27 int result, const std::string& extensions, scoped_ptr<net::StreamSocket>)> | 27 int result, |
| 28 const std::string& extensions, | |
| 29 const std::string& body_head, | |
| 30 scoped_ptr<net::StreamSocket>)> | |
| 28 HttpUpgradeCallback; | 31 HttpUpgradeCallback; |
| 29 typedef base::Callback<void(const std::vector<std::string>&)> SerialsCallback; | 32 typedef base::Callback<void(const std::vector<std::string>&)> SerialsCallback; |
| 30 | 33 |
| 31 struct BrowserInfo { | 34 struct BrowserInfo { |
| 32 BrowserInfo(); | 35 BrowserInfo(); |
| 33 | 36 |
| 34 enum Type { | 37 enum Type { |
| 35 kTypeChrome, | 38 kTypeChrome, |
| 36 kTypeWebView, | 39 kTypeWebView, |
| 37 kTypeOther | 40 kTypeOther |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 | 77 |
| 75 private: | 78 private: |
| 76 friend class Device; | 79 friend class Device; |
| 77 class WebSocketImpl; | 80 class WebSocketImpl; |
| 78 | 81 |
| 79 AndroidWebSocket( | 82 AndroidWebSocket( |
| 80 scoped_refptr<Device> device, | 83 scoped_refptr<Device> device, |
| 81 const std::string& socket_name, | 84 const std::string& socket_name, |
| 82 const std::string& url, | 85 const std::string& url, |
| 83 AndroidWebSocket::Delegate* delegate); | 86 AndroidWebSocket::Delegate* delegate); |
| 87 // |body_head| should contain the body (WebSocket frame data) part that has | |
|
dgozman
2015/04/09 14:05:22
I think this comment belongs to |HttpUpgradeCallba
tyoshino (SeeGerritForStatus)
2015/04/14 12:24:33
Done.
| |
| 88 // been read during processing the header (WebSocket handshake). | |
| 84 void Connected(int result, | 89 void Connected(int result, |
| 85 const std::string& extensions, | 90 const std::string& extensions, |
| 91 const std::string& body_head, | |
| 86 scoped_ptr<net::StreamSocket> socket); | 92 scoped_ptr<net::StreamSocket> socket); |
| 87 void OnFrameRead(const std::string& message); | 93 void OnFrameRead(const std::string& message); |
| 88 void OnSocketClosed(); | 94 void OnSocketClosed(); |
| 89 void Terminate(); | 95 void Terminate(); |
| 90 | 96 |
| 91 Device* device_; | 97 Device* device_; |
| 92 WebSocketImpl* socket_impl_; | 98 WebSocketImpl* socket_impl_; |
| 93 Delegate* delegate_; | 99 Delegate* delegate_; |
| 94 base::WeakPtrFactory<AndroidWebSocket> weak_factory_; | 100 base::WeakPtrFactory<AndroidWebSocket> weak_factory_; |
| 95 DISALLOW_COPY_AND_ASSIGN(AndroidWebSocket); | 101 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; | 236 typedef std::map<std::string, base::WeakPtr<Device> > DeviceWeakMap; |
| 231 | 237 |
| 232 scoped_refptr<HandlerThread> handler_thread_; | 238 scoped_refptr<HandlerThread> handler_thread_; |
| 233 DeviceProviders providers_; | 239 DeviceProviders providers_; |
| 234 DeviceWeakMap devices_; | 240 DeviceWeakMap devices_; |
| 235 | 241 |
| 236 base::WeakPtrFactory<AndroidDeviceManager> weak_factory_; | 242 base::WeakPtrFactory<AndroidDeviceManager> weak_factory_; |
| 237 }; | 243 }; |
| 238 | 244 |
| 239 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ | 245 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ |
| OLD | NEW |