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

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

Issue 2514933003: DevTools: enable target domain handler on the browser target, make browser target non-discoverable.
Patch Set: rebaselined Created 3 years, 10 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/port_forwarding_controller.h" 5 #include "chrome/browser/devtools/device/port_forwarding_controller.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/string_split.h" 16 #include "base/strings/string_split.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/threading/non_thread_safe.h" 18 #include "base/threading/non_thread_safe.h"
19 #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h"
19 #include "chrome/browser/devtools/devtools_protocol.h" 20 #include "chrome/browser/devtools/devtools_protocol.h"
20 #include "chrome/browser/devtools/devtools_protocol_constants.h" 21 #include "chrome/browser/devtools/devtools_protocol_constants.h"
21 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
23 #include "components/keyed_service/content/browser_context_dependency_manager.h" 24 #include "components/keyed_service/content/browser_context_dependency_manager.h"
24 #include "components/prefs/pref_service.h" 25 #include "components/prefs/pref_service.h"
25 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
26 #include "net/base/address_list.h" 27 #include "net/base/address_list.h"
27 #include "net/base/io_buffer.h" 28 #include "net/base/io_buffer.h"
28 #include "net/base/net_errors.h" 29 #include "net/base/net_errors.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser, 254 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser,
254 const ForwardingMap& forwarding_map) 255 const ForwardingMap& forwarding_map)
255 : registry_(registry), 256 : registry_(registry),
256 device_(device), 257 device_(device),
257 browser_(browser), 258 browser_(browser),
258 command_id_(0), 259 command_id_(0),
259 connected_(false), 260 connected_(false),
260 forwarding_map_(forwarding_map) { 261 forwarding_map_(forwarding_map) {
261 DCHECK_CURRENTLY_ON(BrowserThread::UI); 262 DCHECK_CURRENTLY_ON(BrowserThread::UI);
262 (*registry_)[device_->serial()] = this; 263 (*registry_)[device_->serial()] = this;
263 web_socket_.reset( 264 std::string path = kDevToolsRemoteBrowserTarget;
264 device_->CreateWebSocket(browser->socket(), 265 std::string guid = ChromeDevToolsManagerDelegate::GetBrowserGUID();
265 kDevToolsRemoteBrowserTarget, this)); 266 if (!guid.empty())
267 path = path + "/" + guid;
268 web_socket_.reset(device_->CreateWebSocket(browser->socket(), path, this));
266 } 269 }
267 270
268 PortForwardingController::Connection::~Connection() { 271 PortForwardingController::Connection::~Connection() {
269 DCHECK_CURRENTLY_ON(BrowserThread::UI); 272 DCHECK_CURRENTLY_ON(BrowserThread::UI);
270 DCHECK(registry_->find(device_->serial()) != registry_->end()); 273 DCHECK(registry_->find(device_->serial()) != registry_->end());
271 registry_->erase(device_->serial()); 274 registry_->erase(device_->serial());
272 } 275 }
273 276
274 void PortForwardingController::Connection::UpdateForwardingMap( 277 void PortForwardingController::Connection::UpdateForwardingMap(
275 const ForwardingMap& new_forwarding_map) { 278 const ForwardingMap& new_forwarding_map) {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 if (!forwarding_map_.empty()) 494 if (!forwarding_map_.empty())
492 UpdateConnections(); 495 UpdateConnections();
493 else 496 else
494 CloseAllConnections(); 497 CloseAllConnections();
495 } 498 }
496 499
497 void PortForwardingController::UpdateConnections() { 500 void PortForwardingController::UpdateConnections() {
498 for (Registry::iterator it = registry_.begin(); it != registry_.end(); ++it) 501 for (Registry::iterator it = registry_.begin(); it != registry_.end(); ++it)
499 it->second->UpdateForwardingMap(forwarding_map_); 502 it->second->UpdateForwardingMap(forwarding_map_);
500 } 503 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/chrome_devtools_manager_delegate.cc ('k') | content/browser/devtools/browser_devtools_agent_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698