| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/chromeos/login/login_utils.h" | 5 #include "chrome/browser/chromeos/login/login_utils.h" |
| 6 | 6 |
| 7 #include <vector> |
| 8 |
| 7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 10 #include "base/lock.h" | 12 #include "base/lock.h" |
| 11 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 12 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
| 13 #include "base/singleton.h" | 15 #include "base/singleton.h" |
| 14 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 15 #include "base/time.h" | 17 #include "base/time.h" |
| 16 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 browser_launch_enabled_ = enable; | 300 browser_launch_enabled_ = enable; |
| 299 } | 301 } |
| 300 | 302 |
| 301 bool LoginUtilsImpl::IsBrowserLaunchEnabled() const { | 303 bool LoginUtilsImpl::IsBrowserLaunchEnabled() const { |
| 302 return browser_launch_enabled_; | 304 return browser_launch_enabled_; |
| 303 } | 305 } |
| 304 | 306 |
| 305 // We use a special class for this so that it can be safely leaked if we | 307 // We use a special class for this so that it can be safely leaked if we |
| 306 // never connect. At shutdown the order is not well defined, and it's possible | 308 // never connect. At shutdown the order is not well defined, and it's possible |
| 307 // for the infrastructure needed to unregister might be unstable and crash. | 309 // for the infrastructure needed to unregister might be unstable and crash. |
| 308 class WarmingObserver : public NetworkLibrary::Observer { | 310 class WarmingObserver : public NetworkLibrary::NetworkManagerObserver { |
| 309 public: | 311 public: |
| 310 WarmingObserver() { | 312 WarmingObserver() { |
| 311 NetworkLibrary *network = CrosLibrary::Get()->GetNetworkLibrary(); | 313 NetworkLibrary *netlib = CrosLibrary::Get()->GetNetworkLibrary(); |
| 312 network->AddObserver(this); | 314 netlib->AddNetworkManagerObserver(this); |
| 313 } | 315 } |
| 314 | 316 |
| 315 // If we're now connected, prewarm the auth url. | 317 // If we're now connected, prewarm the auth url. |
| 316 void NetworkChanged(NetworkLibrary* network) { | 318 void OnNetworkManagerChanged(NetworkLibrary* netlib) { |
| 317 if (network->Connected()) { | 319 if (netlib->Connected()) { |
| 318 chrome_browser_net::Preconnect::PreconnectOnUIThread( | 320 chrome_browser_net::Preconnect::PreconnectOnUIThread( |
| 319 GURL(GaiaAuthenticator2::kClientLoginUrl), | 321 GURL(GaiaAuthenticator2::kClientLoginUrl), |
| 320 chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED); | 322 chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED); |
| 321 network->RemoveObserver(this); | 323 netlib->RemoveNetworkManagerObserver(this); |
| 322 delete this; | 324 delete this; |
| 323 } | 325 } |
| 324 } | 326 } |
| 325 }; | 327 }; |
| 326 | 328 |
| 327 void LoginUtilsImpl::PrewarmAuthentication() { | 329 void LoginUtilsImpl::PrewarmAuthentication() { |
| 328 if (CrosLibrary::Get()->EnsureLoaded()) { | 330 if (CrosLibrary::Get()->EnsureLoaded()) { |
| 329 NetworkLibrary *network = CrosLibrary::Get()->GetNetworkLibrary(); | 331 NetworkLibrary *network = CrosLibrary::Get()->GetNetworkLibrary(); |
| 330 if (network->Connected()) { | 332 if (network->Connected()) { |
| 331 chrome_browser_net::Preconnect::PreconnectOnUIThread( | 333 chrome_browser_net::Preconnect::PreconnectOnUIThread( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 359 BrowserInit browser_init; | 361 BrowserInit browser_init; |
| 360 int return_code; | 362 int return_code; |
| 361 browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(), | 363 browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(), |
| 362 profile, | 364 profile, |
| 363 FilePath(), | 365 FilePath(), |
| 364 true, | 366 true, |
| 365 &return_code); | 367 &return_code); |
| 366 } | 368 } |
| 367 | 369 |
| 368 } // namespace chromeos | 370 } // namespace chromeos |
| OLD | NEW |