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/port_forwarding_controller.h" | 5 #include "chrome/browser/devtools/device/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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 235 |
236 static scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> | 236 static scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> |
237 FindBestBrowserForTethering( | 237 FindBestBrowserForTethering( |
238 const DevToolsAndroidBridge::RemoteBrowsers browsers) { | 238 const DevToolsAndroidBridge::RemoteBrowsers browsers) { |
239 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> best_browser; | 239 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> best_browser; |
240 ParsedVersion newest_version; | 240 ParsedVersion newest_version; |
241 for (DevToolsAndroidBridge::RemoteBrowsers::const_iterator it = | 241 for (DevToolsAndroidBridge::RemoteBrowsers::const_iterator it = |
242 browsers.begin(); it != browsers.end(); ++it) { | 242 browsers.begin(); it != browsers.end(); ++it) { |
243 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser = *it; | 243 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser = *it; |
244 ParsedVersion current_version = browser->GetParsedVersion(); | 244 ParsedVersion current_version = browser->GetParsedVersion(); |
245 if (browser->IsChrome() && | 245 if (IsPortForwardingSupported(current_version) && |
246 IsPortForwardingSupported(current_version) && | |
247 IsVersionLower(newest_version, current_version)) { | 246 IsVersionLower(newest_version, current_version)) { |
248 best_browser = browser; | 247 best_browser = browser; |
249 newest_version = current_version; | 248 newest_version = current_version; |
250 } | 249 } |
251 } | 250 } |
252 return best_browser; | 251 return best_browser; |
253 } | 252 } |
254 | 253 |
255 } // namespace | 254 } // namespace |
256 | 255 |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 "PortForwardingController", | 668 "PortForwardingController", |
670 BrowserContextDependencyManager::GetInstance()) {} | 669 BrowserContextDependencyManager::GetInstance()) {} |
671 | 670 |
672 PortForwardingController::Factory::~Factory() {} | 671 PortForwardingController::Factory::~Factory() {} |
673 | 672 |
674 KeyedService* PortForwardingController::Factory::BuildServiceInstanceFor( | 673 KeyedService* PortForwardingController::Factory::BuildServiceInstanceFor( |
675 content::BrowserContext* context) const { | 674 content::BrowserContext* context) const { |
676 Profile* profile = Profile::FromBrowserContext(context); | 675 Profile* profile = Profile::FromBrowserContext(context); |
677 return new PortForwardingController(profile); | 676 return new PortForwardingController(profile); |
678 } | 677 } |
OLD | NEW |