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

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

Issue 2437633003: [DevTools] Switch remote locations to Target domain. (Closed)
Patch Set: removed dispose 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/devtools_device_discovery.h" 5 #include "chrome/browser/devtools/device/devtools_device_discovery.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 base::StartsWith(browser_id_, kWebViewSocketPrefix, 263 base::StartsWith(browser_id_, kWebViewSocketPrefix,
264 base::CompareCase::SENSITIVE) 264 base::CompareCase::SENSITIVE)
265 ? base::UserMetricsAction("DevTools_InspectAndroidWebView") 265 ? base::UserMetricsAction("DevTools_InspectAndroidWebView")
266 : base::UserMetricsAction("DevTools_InspectAndroidPage")); 266 : base::UserMetricsAction("DevTools_InspectAndroidPage"));
267 web_socket_.reset( 267 web_socket_.reset(
268 device_->CreateWebSocket(browser_id_, target_path_, this)); 268 device_->CreateWebSocket(browser_id_, target_path_, this));
269 } 269 }
270 270
271 void AgentHostDelegate::Detach() { 271 void AgentHostDelegate::Detach() {
272 web_socket_.reset(); 272 web_socket_.reset();
273 proxy_->ConnectionClosed();
273 proxy_ = nullptr; 274 proxy_ = nullptr;
274 } 275 }
275 276
276 std::string AgentHostDelegate::GetType() { 277 std::string AgentHostDelegate::GetType() {
277 return remote_type_; 278 return remote_type_;
278 } 279 }
279 280
280 std::string AgentHostDelegate::GetTitle() { 281 std::string AgentHostDelegate::GetTitle() {
281 return title_; 282 return title_;
282 } 283 }
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 } 611 }
611 612
612 void DevToolsDeviceDiscovery::ReceivedDeviceList( 613 void DevToolsDeviceDiscovery::ReceivedDeviceList(
613 const CompleteDevices& complete_devices) { 614 const CompleteDevices& complete_devices) {
614 DCHECK_CURRENTLY_ON(BrowserThread::UI); 615 DCHECK_CURRENTLY_ON(BrowserThread::UI);
615 task_scheduler_.Run(base::Bind(&DevToolsDeviceDiscovery::RequestDeviceList, 616 task_scheduler_.Run(base::Bind(&DevToolsDeviceDiscovery::RequestDeviceList,
616 weak_factory_.GetWeakPtr())); 617 weak_factory_.GetWeakPtr()));
617 // |callback_| should be run last as it may destroy |this|. 618 // |callback_| should be run last as it may destroy |this|.
618 callback_.Run(complete_devices); 619 callback_.Run(complete_devices);
619 } 620 }
620
621 namespace {
622
623 class OnceWrapper {
624 public:
625 OnceWrapper(AndroidDeviceManager* device_manager,
626 const DevToolsDeviceDiscovery::DeviceListCallback& callback)
627 : callback_(callback) {
628 discovery_.reset(new DevToolsDeviceDiscovery(device_manager,
629 base::Bind(&OnceWrapper::Callback, base::Unretained(this))));
630 discovery_->SetScheduler(base::Bind(&OnceWrapper::NoOp));
631 }
632
633 private:
634 static void NoOp(const base::Closure&) {}
635
636 void Callback(const DevToolsDeviceDiscovery::CompleteDevices& devices) {
637 callback_.Run(devices);
638 delete this;
639 }
640
641 std::unique_ptr<DevToolsDeviceDiscovery> discovery_;
642 const DevToolsDeviceDiscovery::DeviceListCallback callback_;
643 };
644
645 } // namespace
646
647 // static
648 void DevToolsDeviceDiscovery::DiscoverOnce(
649 AndroidDeviceManager* device_manager,
650 const DeviceListCallback& callback) {
651 new OnceWrapper(device_manager, callback);
652 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/device/devtools_device_discovery.h ('k') | chrome/browser/devtools/devtools_network_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698