OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/remote_debugging_server.h" | 5 #include "chrome/browser/devtools/remote_debugging_server.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 return socket; | 53 return socket; |
54 } | 54 } |
55 | 55 |
56 scoped_ptr<net::ServerSocket> CreateForTethering(std::string* name) override { | 56 scoped_ptr<net::ServerSocket> CreateForTethering(std::string* name) override { |
57 if (!g_tethering_enabled.Get()) | 57 if (!g_tethering_enabled.Get()) |
58 return scoped_ptr<net::ServerSocket>(); | 58 return scoped_ptr<net::ServerSocket>(); |
59 | 59 |
60 if (last_tethering_port_ == kMaxTetheringPort) | 60 if (last_tethering_port_ == kMaxTetheringPort) |
61 last_tethering_port_ = kMinTetheringPort; | 61 last_tethering_port_ = kMinTetheringPort; |
62 uint16 port = ++last_tethering_port_; | 62 uint16 port = ++last_tethering_port_; |
63 *name = base::IntToString(port); | 63 *name = base::UintToString(port); |
64 scoped_ptr<net::TCPServerSocket> socket( | 64 scoped_ptr<net::TCPServerSocket> socket( |
65 new net::TCPServerSocket(nullptr, net::NetLog::Source())); | 65 new net::TCPServerSocket(nullptr, net::NetLog::Source())); |
66 if (socket->ListenWithAddressAndPort("127.0.0.1", port, kBackLog) != | 66 if (socket->ListenWithAddressAndPort("127.0.0.1", port, kBackLog) != |
67 net::OK) { | 67 net::OK) { |
68 return scoped_ptr<net::ServerSocket>(); | 68 return scoped_ptr<net::ServerSocket>(); |
69 } | 69 } |
70 return socket.Pass(); | 70 return socket.Pass(); |
71 } | 71 } |
72 | 72 |
73 std::string address_; | 73 std::string address_; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 debug_frontend_dir, | 177 debug_frontend_dir, |
178 version_info::GetProductNameAndVersionForUserAgent(), | 178 version_info::GetProductNameAndVersionForUserAgent(), |
179 ::GetUserAgent())); | 179 ::GetUserAgent())); |
180 } | 180 } |
181 | 181 |
182 RemoteDebuggingServer::~RemoteDebuggingServer() { | 182 RemoteDebuggingServer::~RemoteDebuggingServer() { |
183 // Ensure Profile is alive, because the whole DevTools subsystem | 183 // Ensure Profile is alive, because the whole DevTools subsystem |
184 // accesses it during shutdown. | 184 // accesses it during shutdown. |
185 DCHECK(g_browser_process->profile_manager()); | 185 DCHECK(g_browser_process->profile_manager()); |
186 } | 186 } |
OLD | NEW |