| 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 <utility> |
| 8 |
| 7 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 10 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 11 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/devtools/devtools_window.h" | 14 #include "chrome/browser/devtools/devtools_window.h" |
| 13 #include "chrome/browser/history/top_sites_factory.h" | 15 #include "chrome/browser/history/top_sites_factory.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_iterator.h" | 18 #include "chrome/browser/ui/browser_iterator.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 if (last_tethering_port_ == kMaxTetheringPort) | 62 if (last_tethering_port_ == kMaxTetheringPort) |
| 61 last_tethering_port_ = kMinTetheringPort; | 63 last_tethering_port_ = kMinTetheringPort; |
| 62 uint16_t port = ++last_tethering_port_; | 64 uint16_t port = ++last_tethering_port_; |
| 63 *name = base::UintToString(port); | 65 *name = base::UintToString(port); |
| 64 scoped_ptr<net::TCPServerSocket> socket( | 66 scoped_ptr<net::TCPServerSocket> socket( |
| 65 new net::TCPServerSocket(nullptr, net::NetLog::Source())); | 67 new net::TCPServerSocket(nullptr, net::NetLog::Source())); |
| 66 if (socket->ListenWithAddressAndPort("127.0.0.1", port, kBackLog) != | 68 if (socket->ListenWithAddressAndPort("127.0.0.1", port, kBackLog) != |
| 67 net::OK) { | 69 net::OK) { |
| 68 return scoped_ptr<net::ServerSocket>(); | 70 return scoped_ptr<net::ServerSocket>(); |
| 69 } | 71 } |
| 70 return socket.Pass(); | 72 return std::move(socket); |
| 71 } | 73 } |
| 72 | 74 |
| 73 std::string address_; | 75 std::string address_; |
| 74 uint16_t port_; | 76 uint16_t port_; |
| 75 uint16_t last_tethering_port_; | 77 uint16_t last_tethering_port_; |
| 76 | 78 |
| 77 DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory); | 79 DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory); |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 class ChromeDevToolsHttpHandlerDelegate | 82 class ChromeDevToolsHttpHandlerDelegate |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 debug_frontend_dir, | 179 debug_frontend_dir, |
| 178 version_info::GetProductNameAndVersionForUserAgent(), | 180 version_info::GetProductNameAndVersionForUserAgent(), |
| 179 ::GetUserAgent())); | 181 ::GetUserAgent())); |
| 180 } | 182 } |
| 181 | 183 |
| 182 RemoteDebuggingServer::~RemoteDebuggingServer() { | 184 RemoteDebuggingServer::~RemoteDebuggingServer() { |
| 183 // Ensure Profile is alive, because the whole DevTools subsystem | 185 // Ensure Profile is alive, because the whole DevTools subsystem |
| 184 // accesses it during shutdown. | 186 // accesses it during shutdown. |
| 185 DCHECK(g_browser_process->profile_manager()); | 187 DCHECK(g_browser_process->profile_manager()); |
| 186 } | 188 } |
| OLD | NEW |