| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 // We use a special class for this so that it can be safely leaked if we | 525 // We use a special class for this so that it can be safely leaked if we |
| 526 // never connect. At shutdown the order is not well defined, and it's possible | 526 // never connect. At shutdown the order is not well defined, and it's possible |
| 527 // for the infrastructure needed to unregister might be unstable and crash. | 527 // for the infrastructure needed to unregister might be unstable and crash. |
| 528 class WarmingObserver : public NetworkLibrary::NetworkManagerObserver { | 528 class WarmingObserver : public NetworkLibrary::NetworkManagerObserver { |
| 529 public: | 529 public: |
| 530 WarmingObserver() { | 530 WarmingObserver() { |
| 531 NetworkLibrary *netlib = CrosLibrary::Get()->GetNetworkLibrary(); | 531 NetworkLibrary *netlib = CrosLibrary::Get()->GetNetworkLibrary(); |
| 532 netlib->AddNetworkManagerObserver(this); | 532 netlib->AddNetworkManagerObserver(this); |
| 533 } | 533 } |
| 534 | 534 |
| 535 virtual ~WarmingObserver() {} |
| 536 |
| 535 // If we're now connected, prewarm the auth url. | 537 // If we're now connected, prewarm the auth url. |
| 536 void OnNetworkManagerChanged(NetworkLibrary* netlib) { | 538 virtual void OnNetworkManagerChanged(NetworkLibrary* netlib) { |
| 537 if (netlib->Connected()) { | 539 if (netlib->Connected()) { |
| 538 const int kConnectionsNeeded = 1; | 540 const int kConnectionsNeeded = 1; |
| 539 chrome_browser_net::PreconnectOnUIThread( | 541 chrome_browser_net::PreconnectOnUIThread( |
| 540 GURL(GaiaAuthFetcher::kClientLoginUrl), | 542 GURL(GaiaAuthFetcher::kClientLoginUrl), |
| 541 chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED, | 543 chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED, |
| 542 kConnectionsNeeded); | 544 kConnectionsNeeded); |
| 543 netlib->RemoveNetworkManagerObserver(this); | 545 netlib->RemoveNetworkManagerObserver(this); |
| 544 delete this; | 546 delete this; |
| 545 } | 547 } |
| 546 } | 548 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 // Mark login host for deletion after browser starts. This | 595 // Mark login host for deletion after browser starts. This |
| 594 // guarantees that the message loop will be referenced by the | 596 // guarantees that the message loop will be referenced by the |
| 595 // browser before it is dereferenced by the login host. | 597 // browser before it is dereferenced by the login host. |
| 596 if (login_host) { | 598 if (login_host) { |
| 597 login_host->OnSessionStart(); | 599 login_host->OnSessionStart(); |
| 598 login_host = NULL; | 600 login_host = NULL; |
| 599 } | 601 } |
| 600 } | 602 } |
| 601 | 603 |
| 602 } // namespace chromeos | 604 } // namespace chromeos |
| OLD | NEW |