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

Side by Side Diff: chrome/browser/devtools/adb_web_socket.cc

Issue 26568004: Introduced AndroidDeviceProvider to simplify testing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unused constants, thus fixed compile errors. Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/devtools/adb_web_socket.h ('k') | chrome/browser/devtools/android_device.h » ('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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "chrome/browser/devtools/adb_web_socket.h" 5 #include "chrome/browser/devtools/adb_web_socket.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
12 #include "net/server/web_socket.h" 12 #include "net/server/web_socket.h"
13 13
14 using content::BrowserThread; 14 using content::BrowserThread;
15 using net::WebSocket; 15 using net::WebSocket;
16 16
17 const int kBufferSize = 16 * 1024; 17 const int kBufferSize = 16 * 1024;
18 18
19 static const char kWebSocketUpgradeRequest[] = "GET %s HTTP/1.1\r\n" 19 static const char kWebSocketUpgradeRequest[] = "GET %s HTTP/1.1\r\n"
20 "Upgrade: WebSocket\r\n" 20 "Upgrade: WebSocket\r\n"
21 "Connection: Upgrade\r\n" 21 "Connection: Upgrade\r\n"
22 "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n" 22 "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n"
23 "Sec-WebSocket-Version: 13\r\n" 23 "Sec-WebSocket-Version: 13\r\n"
24 "\r\n"; 24 "\r\n";
25 25
26 AdbWebSocket::AdbWebSocket( 26 AdbWebSocket::AdbWebSocket(
27 scoped_refptr<DevToolsAdbBridge::AndroidDevice> device, 27 scoped_refptr<AndroidDevice> device,
28 const std::string& socket_name, 28 const std::string& socket_name,
29 const std::string& url, 29 const std::string& url,
30 base::MessageLoop* adb_message_loop, 30 base::MessageLoop* adb_message_loop,
31 Delegate* delegate) 31 Delegate* delegate)
32 : device_(device), 32 : device_(device),
33 socket_name_(socket_name), 33 socket_name_(socket_name),
34 url_(url), 34 url_(url),
35 adb_message_loop_(adb_message_loop), 35 adb_message_loop_(adb_message_loop),
36 delegate_(delegate) { 36 delegate_(delegate) {
37 adb_message_loop_->PostTask( 37 adb_message_loop_->PostTask(
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 delegate_->OnSocketOpened(); 169 delegate_->OnSocketOpened();
170 } 170 }
171 171
172 void AdbWebSocket::OnFrameRead(const std::string& message) { 172 void AdbWebSocket::OnFrameRead(const std::string& message) {
173 delegate_->OnFrameRead(message); 173 delegate_->OnFrameRead(message);
174 } 174 }
175 175
176 void AdbWebSocket::OnSocketClosed(bool closed_by_device) { 176 void AdbWebSocket::OnSocketClosed(bool closed_by_device) {
177 delegate_->OnSocketClosed(closed_by_device); 177 delegate_->OnSocketClosed(closed_by_device);
178 } 178 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/adb_web_socket.h ('k') | chrome/browser/devtools/android_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698