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 if (!device->IsConnected()) |
| 599 continue; |
| 600 Registry::iterator rit = registry_.find(device->GetSerial()); |
599 if (rit == registry_.end()) { | 601 if (rit == registry_.end()) { |
600 std::string socket = FindBestSocketForTethering(device->browsers()); | 602 std::string socket = FindBestSocketForTethering(device->browsers()); |
601 if (!socket.empty() || device->serial().empty()) { | 603 if (!socket.empty() || device->GetSerial().empty()) { |
602 // Will delete itself when disconnected. | 604 // Will delete itself when disconnected. |
603 new Connection( | 605 new Connection( |
604 ®istry_, device->device(), socket, adb_thread_, pref_service_); | 606 ®istry_, device->device(), socket, adb_thread_, pref_service_); |
605 } | 607 } |
606 } else { | 608 } else { |
607 status[device->serial()] = (*rit).second->GetPortStatusMap(); | 609 status[device->GetSerial()] = (*rit).second->GetPortStatusMap(); |
608 } | 610 } |
609 } | 611 } |
610 return status; | 612 return status; |
611 } | 613 } |
612 | 614 |
613 // static | 615 // static |
614 PortForwardingController::Factory* | 616 PortForwardingController::Factory* |
615 PortForwardingController::Factory::GetInstance() { | 617 PortForwardingController::Factory::GetInstance() { |
616 return Singleton<PortForwardingController::Factory>::get(); | 618 return Singleton<PortForwardingController::Factory>::get(); |
617 } | 619 } |
(...skipping 11 matching lines...) Expand all Loading... |
629 BrowserContextDependencyManager::GetInstance()) {} | 631 BrowserContextDependencyManager::GetInstance()) {} |
630 | 632 |
631 PortForwardingController::Factory::~Factory() {} | 633 PortForwardingController::Factory::~Factory() {} |
632 | 634 |
633 BrowserContextKeyedService* | 635 BrowserContextKeyedService* |
634 PortForwardingController::Factory::BuildServiceInstanceFor( | 636 PortForwardingController::Factory::BuildServiceInstanceFor( |
635 content::BrowserContext* context) const { | 637 content::BrowserContext* context) const { |
636 Profile* profile = Profile::FromBrowserContext(context); | 638 Profile* profile = Profile::FromBrowserContext(context); |
637 return new PortForwardingController(profile->GetPrefs()); | 639 return new PortForwardingController(profile->GetPrefs()); |
638 } | 640 } |
OLD | NEW |