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

Side by Side Diff: chrome/browser/devtools/device/tcp_device_provider.cc

Issue 2333923004: Extracting NetLog inner classes into their own classes. (Closed)
Patch Set: Some nit fixes and better, impl-agnostic naming of net_log_parameters_callback_typedef.h -> net/log… Created 4 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
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 #include "chrome/browser/devtools/device/tcp_device_provider.h" 5 #include "chrome/browser/devtools/device/tcp_device_provider.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "base/threading/thread_task_runner_handle.h" 14 #include "base/threading/thread_task_runner_handle.h"
15 #include "chrome/browser/devtools/device/adb/adb_client_socket.h" 15 #include "chrome/browser/devtools/device/adb/adb_client_socket.h"
16 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
17 #include "net/dns/host_resolver.h" 17 #include "net/dns/host_resolver.h"
18 #include "net/log/net_log_source.h"
19 #include "net/log/net_log_with_source.h"
18 #include "net/socket/tcp_client_socket.h" 20 #include "net/socket/tcp_client_socket.h"
19 21
20 namespace { 22 namespace {
21 23
22 const char kDeviceModel[] = "Remote Target"; 24 const char kDeviceModel[] = "Remote Target";
23 const char kBrowserName[] = "Target"; 25 const char kBrowserName[] = "Target";
24 26
25 static void RunSocketCallback( 27 static void RunSocketCallback(
26 const AndroidDeviceManager::SocketCallback& callback, 28 const AndroidDeviceManager::SocketCallback& callback,
27 std::unique_ptr<net::StreamSocket> socket, 29 std::unique_ptr<net::StreamSocket> socket,
(...skipping 18 matching lines...) Expand all
46 } 48 }
47 49
48 private: 50 private:
49 void OnResolved(int result) { 51 void OnResolved(int result) {
50 if (result < 0) { 52 if (result < 0) {
51 RunSocketCallback(callback_, nullptr, result); 53 RunSocketCallback(callback_, nullptr, result);
52 delete this; 54 delete this;
53 return; 55 return;
54 } 56 }
55 std::unique_ptr<net::StreamSocket> socket(new net::TCPClientSocket( 57 std::unique_ptr<net::StreamSocket> socket(new net::TCPClientSocket(
56 address_list_, NULL, NULL, net::NetLog::Source())); 58 address_list_, NULL, NULL, net::NetLogSource()));
57 socket->Connect( 59 socket->Connect(
58 base::Bind(&RunSocketCallback, callback_, base::Passed(&socket))); 60 base::Bind(&RunSocketCallback, callback_, base::Passed(&socket)));
59 delete this; 61 delete this;
60 } 62 }
61 63
62 std::unique_ptr<net::HostResolver> host_resolver_; 64 std::unique_ptr<net::HostResolver> host_resolver_;
63 std::unique_ptr<net::HostResolver::Request> request_; 65 std::unique_ptr<net::HostResolver::Request> request_;
64 net::AddressList address_list_; 66 net::AddressList address_list_;
65 AdbClientSocket::SocketCallback callback_; 67 AdbClientSocket::SocketCallback callback_;
66 }; 68 };
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 release_callback_.Run(); 128 release_callback_.Run();
127 } 129 }
128 130
129 void TCPDeviceProvider::set_release_callback_for_test( 131 void TCPDeviceProvider::set_release_callback_for_test(
130 const base::Closure& callback) { 132 const base::Closure& callback) {
131 release_callback_ = callback; 133 release_callback_ = callback;
132 } 134 }
133 135
134 TCPDeviceProvider::~TCPDeviceProvider() { 136 TCPDeviceProvider::~TCPDeviceProvider() {
135 } 137 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698