Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/port_forwarding_controller.h" | 5 #include "chrome/browser/devtools/port_forwarding_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 it->second->Shutdown(); | 588 it->second->Shutdown(); |
| 589 } | 589 } |
| 590 | 590 |
| 591 PortForwardingController::DevicesStatus | 591 PortForwardingController::DevicesStatus |
| 592 PortForwardingController::UpdateDeviceList( | 592 PortForwardingController::UpdateDeviceList( |
| 593 const DevToolsAdbBridge::RemoteDevices& devices) { | 593 const DevToolsAdbBridge::RemoteDevices& devices) { |
| 594 DevicesStatus status; | 594 DevicesStatus status; |
| 595 for (DevToolsAdbBridge::RemoteDevices::const_iterator it = devices.begin(); | 595 for (DevToolsAdbBridge::RemoteDevices::const_iterator it = devices.begin(); |
| 596 it != devices.end(); ++it) { | 596 it != devices.end(); ++it) { |
| 597 scoped_refptr<DevToolsAdbBridge::RemoteDevice> device = *it; | 597 scoped_refptr<DevToolsAdbBridge::RemoteDevice> device = *it; |
| 598 Registry::iterator rit = registry_.find(device->serial()); | 598 Registry::iterator rit = registry_.find(device->GetSerial()); |
|
Vladislav Kaznacheev
2013/10/08 16:42:37
How about adding device->IsConnected check and not
pfeldman
2013/10/08 17:11:04
Yep, thanks.
| |
| 599 if (rit == registry_.end()) { | 599 if (rit == registry_.end()) { |
| 600 std::string socket = FindBestSocketForTethering(device->browsers()); | 600 std::string socket = FindBestSocketForTethering(device->browsers()); |
| 601 if (!socket.empty() || device->serial().empty()) { | 601 if (!socket.empty() || device->GetSerial().empty()) { |
| 602 // Will delete itself when disconnected. | 602 // Will delete itself when disconnected. |
| 603 new Connection( | 603 new Connection( |
| 604 ®istry_, device->device(), socket, adb_thread_, pref_service_); | 604 ®istry_, device->device(), socket, adb_thread_, pref_service_); |
| 605 } | 605 } |
| 606 } else { | 606 } else { |
| 607 status[device->serial()] = (*rit).second->GetPortStatusMap(); | 607 status[device->GetSerial()] = (*rit).second->GetPortStatusMap(); |
| 608 } | 608 } |
| 609 } | 609 } |
| 610 return status; | 610 return status; |
| 611 } | 611 } |
| 612 | 612 |
| 613 // static | 613 // static |
| 614 PortForwardingController::Factory* | 614 PortForwardingController::Factory* |
| 615 PortForwardingController::Factory::GetInstance() { | 615 PortForwardingController::Factory::GetInstance() { |
| 616 return Singleton<PortForwardingController::Factory>::get(); | 616 return Singleton<PortForwardingController::Factory>::get(); |
| 617 } | 617 } |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 629 BrowserContextDependencyManager::GetInstance()) {} | 629 BrowserContextDependencyManager::GetInstance()) {} |
| 630 | 630 |
| 631 PortForwardingController::Factory::~Factory() {} | 631 PortForwardingController::Factory::~Factory() {} |
| 632 | 632 |
| 633 BrowserContextKeyedService* | 633 BrowserContextKeyedService* |
| 634 PortForwardingController::Factory::BuildServiceInstanceFor( | 634 PortForwardingController::Factory::BuildServiceInstanceFor( |
| 635 content::BrowserContext* context) const { | 635 content::BrowserContext* context) const { |
| 636 Profile* profile = Profile::FromBrowserContext(context); | 636 Profile* profile = Profile::FromBrowserContext(context); |
| 637 return new PortForwardingController(profile->GetPrefs()); | 637 return new PortForwardingController(profile->GetPrefs()); |
| 638 } | 638 } |
| OLD | NEW |