| OLD | NEW |
| 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/metrics/user_metrics.h" | 10 #include "base/metrics/user_metrics.h" |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 DevToolsDeviceDiscovery::RemotePage::~RemotePage() { | 505 DevToolsDeviceDiscovery::RemotePage::~RemotePage() { |
| 506 } | 506 } |
| 507 | 507 |
| 508 scoped_refptr<content::DevToolsAgentHost> | 508 scoped_refptr<content::DevToolsAgentHost> |
| 509 DevToolsDeviceDiscovery::RemotePage::CreateTarget() { | 509 DevToolsDeviceDiscovery::RemotePage::CreateTarget() { |
| 510 std::string local_id = BuildUniqueTargetId(device_->serial(), | 510 std::string local_id = BuildUniqueTargetId(device_->serial(), |
| 511 browser_id_, | 511 browser_id_, |
| 512 dict_.get()); | 512 dict_.get()); |
| 513 std::string target_path = GetTargetPath(dict_.get()); | 513 std::string target_path = GetTargetPath(dict_.get()); |
| 514 std::string type = GetStringProperty(dict_.get(), "type"); | 514 std::string type = GetStringProperty(dict_.get(), "type"); |
| 515 | 515 agent_host_ = AgentHostDelegate::GetOrCreateAgentHost( |
| 516 return AgentHostDelegate::GetOrCreateAgentHost( | |
| 517 device_, browser_id_, local_id, target_path, type, dict_.get()); | 516 device_, browser_id_, local_id, target_path, type, dict_.get()); |
| 517 return agent_host_; |
| 518 } | 518 } |
| 519 | 519 |
| 520 // DevToolsDeviceDiscovery::RemoteBrowser ------------------------------------- | 520 // DevToolsDeviceDiscovery::RemoteBrowser ------------------------------------- |
| 521 | 521 |
| 522 DevToolsDeviceDiscovery::RemoteBrowser::RemoteBrowser( | 522 DevToolsDeviceDiscovery::RemoteBrowser::RemoteBrowser( |
| 523 const std::string& serial, | 523 const std::string& serial, |
| 524 const AndroidDeviceManager::BrowserInfo& browser_info) | 524 const AndroidDeviceManager::BrowserInfo& browser_info) |
| 525 : serial_(serial), | 525 : serial_(serial), |
| 526 browser_id_(browser_info.socket_name), | 526 browser_id_(browser_info.socket_name), |
| 527 display_name_(browser_info.display_name), | 527 display_name_(browser_info.display_name), |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 } | 617 } |
| 618 | 618 |
| 619 void DevToolsDeviceDiscovery::ReceivedDeviceList( | 619 void DevToolsDeviceDiscovery::ReceivedDeviceList( |
| 620 const CompleteDevices& complete_devices) { | 620 const CompleteDevices& complete_devices) { |
| 621 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 621 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 622 task_scheduler_.Run(base::Bind(&DevToolsDeviceDiscovery::RequestDeviceList, | 622 task_scheduler_.Run(base::Bind(&DevToolsDeviceDiscovery::RequestDeviceList, |
| 623 weak_factory_.GetWeakPtr())); | 623 weak_factory_.GetWeakPtr())); |
| 624 // |callback_| should be run last as it may destroy |this|. | 624 // |callback_| should be run last as it may destroy |this|. |
| 625 callback_.Run(complete_devices); | 625 callback_.Run(complete_devices); |
| 626 } | 626 } |
| OLD | NEW |