Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: chrome/browser/devtools/device/android_device_manager.h

Issue 747903006: [DevTools] Support permessage-deflate in AndroidWebSocket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@deflate
Patch Set: rebased Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/devtools/device/android_device_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/size.h" 15 #include "ui/gfx/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(
27 int result, const std::string& extensions, scoped_ptr<net::StreamSocket>)>
28 HttpUpgradeCallback;
26 typedef base::Callback<void(const std::vector<std::string>&)> SerialsCallback; 29 typedef base::Callback<void(const std::vector<std::string>&)> SerialsCallback;
27 30
28 struct BrowserInfo { 31 struct BrowserInfo {
29 BrowserInfo(); 32 BrowserInfo();
30 33
31 enum Type { 34 enum Type {
32 kTypeChrome, 35 kTypeChrome,
33 kTypeWebView, 36 kTypeWebView,
34 kTypeOther 37 kTypeOther
35 }; 38 };
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 73
71 private: 74 private:
72 friend class Device; 75 friend class Device;
73 class WebSocketImpl; 76 class WebSocketImpl;
74 77
75 AndroidWebSocket( 78 AndroidWebSocket(
76 scoped_refptr<Device> device, 79 scoped_refptr<Device> device,
77 const std::string& socket_name, 80 const std::string& socket_name,
78 const std::string& url, 81 const std::string& url,
79 AndroidWebSocket::Delegate* delegate); 82 AndroidWebSocket::Delegate* delegate);
80 void Connected(int result, scoped_ptr<net::StreamSocket> socket); 83 void Connected(int result,
84 const std::string& extensions,
85 scoped_ptr<net::StreamSocket> socket);
81 void OnFrameRead(const std::string& message); 86 void OnFrameRead(const std::string& message);
82 void OnSocketClosed(); 87 void OnSocketClosed();
83 void Terminate(); 88 void Terminate();
84 89
85 Device* device_; 90 Device* device_;
86 WebSocketImpl* socket_impl_; 91 WebSocketImpl* socket_impl_;
87 Delegate* delegate_; 92 Delegate* delegate_;
88 base::WeakPtrFactory<AndroidWebSocket> weak_factory_; 93 base::WeakPtrFactory<AndroidWebSocket> weak_factory_;
89 DISALLOW_COPY_AND_ASSIGN(AndroidWebSocket); 94 DISALLOW_COPY_AND_ASSIGN(AndroidWebSocket);
90 }; 95 };
91 96
92 class DeviceProvider; 97 class DeviceProvider;
93 98
94 class Device : public base::RefCountedThreadSafe<Device>, 99 class Device : public base::RefCountedThreadSafe<Device>,
95 public base::NonThreadSafe { 100 public base::NonThreadSafe {
96 public: 101 public:
97 void QueryDeviceInfo(const DeviceInfoCallback& callback); 102 void QueryDeviceInfo(const DeviceInfoCallback& callback);
98 103
99 void OpenSocket(const std::string& socket_name, 104 void OpenSocket(const std::string& socket_name,
100 const SocketCallback& callback); 105 const SocketCallback& callback);
101 106
102 void SendJsonRequest(const std::string& socket_name, 107 void SendJsonRequest(const std::string& socket_name,
103 const std::string& request, 108 const std::string& request,
104 const CommandCallback& callback); 109 const CommandCallback& callback);
105 110
106 void HttpUpgrade(const std::string& socket_name, 111 void HttpUpgrade(const std::string& socket_name,
107 const std::string& url, 112 const std::string& url,
108 const SocketCallback& callback); 113 const std::string& extensions,
114 const HttpUpgradeCallback& callback);
109 AndroidWebSocket* CreateWebSocket( 115 AndroidWebSocket* CreateWebSocket(
110 const std::string& socket_name, 116 const std::string& socket_name,
111 const std::string& url, 117 const std::string& url,
112 AndroidWebSocket::Delegate* delegate); 118 AndroidWebSocket::Delegate* delegate);
113 119
114 std::string serial() { return serial_; } 120 std::string serial() { return serial_; }
115 121
116 private: 122 private:
117 friend class base::RefCountedThreadSafe<Device>; 123 friend class base::RefCountedThreadSafe<Device>;
118 friend class AndroidDeviceManager; 124 friend class AndroidDeviceManager;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 const SocketCallback& callback) = 0; 159 const SocketCallback& callback) = 0;
154 160
155 virtual void SendJsonRequest(const std::string& serial, 161 virtual void SendJsonRequest(const std::string& serial,
156 const std::string& socket_name, 162 const std::string& socket_name,
157 const std::string& request, 163 const std::string& request,
158 const CommandCallback& callback); 164 const CommandCallback& callback);
159 165
160 virtual void HttpUpgrade(const std::string& serial, 166 virtual void HttpUpgrade(const std::string& serial,
161 const std::string& socket_name, 167 const std::string& socket_name,
162 const std::string& url, 168 const std::string& url,
163 const SocketCallback& callback); 169 const std::string& extensions,
170 const HttpUpgradeCallback& callback);
164 171
165 virtual void ReleaseDevice(const std::string& serial); 172 virtual void ReleaseDevice(const std::string& serial);
166 173
167 protected: 174 protected:
168 friend class base::RefCountedThreadSafe<DeviceProvider>; 175 friend class base::RefCountedThreadSafe<DeviceProvider>;
169 DeviceProvider(); 176 DeviceProvider();
170 virtual ~DeviceProvider(); 177 virtual ~DeviceProvider();
171 }; 178 };
172 179
173 typedef std::vector<scoped_refptr<DeviceProvider> > DeviceProviders; 180 typedef std::vector<scoped_refptr<DeviceProvider> > DeviceProviders;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 typedef std::map<std::string, base::WeakPtr<Device> > DeviceWeakMap; 221 typedef std::map<std::string, base::WeakPtr<Device> > DeviceWeakMap;
215 222
216 scoped_refptr<HandlerThread> handler_thread_; 223 scoped_refptr<HandlerThread> handler_thread_;
217 DeviceProviders providers_; 224 DeviceProviders providers_;
218 DeviceWeakMap devices_; 225 DeviceWeakMap devices_;
219 226
220 base::WeakPtrFactory<AndroidDeviceManager> weak_factory_; 227 base::WeakPtrFactory<AndroidDeviceManager> weak_factory_;
221 }; 228 };
222 229
223 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ 230 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/devtools/device/android_device_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698