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

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

Issue 1078733002: Android device manager should not drop WebSocket frame data even if it arrives together with handsh… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 8 months 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/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
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
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_
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