| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/lock.h" | 10 #include "base/lock.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 browser_launch_enabled_ = enable; | 289 browser_launch_enabled_ = enable; |
| 290 } | 290 } |
| 291 | 291 |
| 292 bool LoginUtilsImpl::IsBrowserLaunchEnabled() const { | 292 bool LoginUtilsImpl::IsBrowserLaunchEnabled() const { |
| 293 return browser_launch_enabled_; | 293 return browser_launch_enabled_; |
| 294 } | 294 } |
| 295 | 295 |
| 296 // We use a special class for this so that it can be safely leaked if we | 296 // We use a special class for this so that it can be safely leaked if we |
| 297 // never connect. At shutdown the order is not well defined, and it's possible | 297 // never connect. At shutdown the order is not well defined, and it's possible |
| 298 // for the infrastructure needed to unregister might be unstable and crash. | 298 // for the infrastructure needed to unregister might be unstable and crash. |
| 299 class WarmingObserver : public NetworkLibrary::NetworkManagerObserver { | 299 class WarmingObserver : public NetworkLibrary::Observer { |
| 300 public: | 300 public: |
| 301 WarmingObserver() { | 301 WarmingObserver() { |
| 302 NetworkLibrary *netlib = CrosLibrary::Get()->GetNetworkLibrary(); | 302 NetworkLibrary *network = CrosLibrary::Get()->GetNetworkLibrary(); |
| 303 netlib->AddNetworkManagerObserver(this); | 303 network->AddObserver(this); |
| 304 } | 304 } |
| 305 | 305 |
| 306 // If we're now connected, prewarm the auth url. | 306 // If we're now connected, prewarm the auth url. |
| 307 void OnNetworkManagerChanged(NetworkLibrary* netlib) { | 307 void NetworkChanged(NetworkLibrary* network) { |
| 308 if (netlib->Connected()) { | 308 if (network->Connected()) { |
| 309 chrome_browser_net::Preconnect::PreconnectOnUIThread( | 309 chrome_browser_net::Preconnect::PreconnectOnUIThread( |
| 310 GURL(GaiaAuthenticator2::kClientLoginUrl), | 310 GURL(GaiaAuthenticator2::kClientLoginUrl), |
| 311 chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED); | 311 chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED); |
| 312 netlib->RemoveNetworkManagerObserver(this); | 312 network->RemoveObserver(this); |
| 313 delete this; | 313 delete this; |
| 314 } | 314 } |
| 315 } | 315 } |
| 316 }; | 316 }; |
| 317 | 317 |
| 318 void LoginUtilsImpl::PrewarmAuthentication() { | 318 void LoginUtilsImpl::PrewarmAuthentication() { |
| 319 if (CrosLibrary::Get()->EnsureLoaded()) { | 319 if (CrosLibrary::Get()->EnsureLoaded()) { |
| 320 NetworkLibrary *network = CrosLibrary::Get()->GetNetworkLibrary(); | 320 NetworkLibrary *network = CrosLibrary::Get()->GetNetworkLibrary(); |
| 321 if (network->Connected()) { | 321 if (network->Connected()) { |
| 322 chrome_browser_net::Preconnect::PreconnectOnUIThread( | 322 chrome_browser_net::Preconnect::PreconnectOnUIThread( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 350 BrowserInit browser_init; | 350 BrowserInit browser_init; |
| 351 int return_code; | 351 int return_code; |
| 352 browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(), | 352 browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(), |
| 353 profile, | 353 profile, |
| 354 FilePath(), | 354 FilePath(), |
| 355 true, | 355 true, |
| 356 &return_code); | 356 &return_code); |
| 357 } | 357 } |
| 358 | 358 |
| 359 } // namespace chromeos | 359 } // namespace chromeos |
| OLD | NEW |