| 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_PREWARMER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_PREWARMER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_PREWARMER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_PREWARMER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "chrome/browser/chromeos/net/connectivity_state_helper_observer.h" | 10 #include "chromeos/network/network_state_handler_observer.h" |
| 11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 class URLRequestContextGetter; | 15 class URLRequestContextGetter; |
| 16 } // namespace net | 16 } // namespace net |
| 17 | 17 |
| 18 namespace chromeos { | 18 namespace chromeos { |
| 19 | 19 |
| 20 class NetworkState; |
| 21 |
| 20 // Class for prewarming authentication network connection. | 22 // Class for prewarming authentication network connection. |
| 21 class AuthPrewarmer : public ConnectivityStateHelperObserver, | 23 class AuthPrewarmer : public NetworkStateHandlerObserver, |
| 22 public content::NotificationObserver { | 24 public content::NotificationObserver { |
| 23 public: | 25 public: |
| 24 AuthPrewarmer(); | 26 AuthPrewarmer(); |
| 25 virtual ~AuthPrewarmer(); | 27 virtual ~AuthPrewarmer(); |
| 26 | 28 |
| 27 void PrewarmAuthentication(const base::Closure& completion_callback); | 29 void PrewarmAuthentication(const base::Closure& completion_callback); |
| 28 | 30 |
| 29 private: | 31 private: |
| 30 // chromeos::ConnectivityStateHelperObserver overrides. | 32 // chromeos::NetworkStateHandlerObserver overrides. |
| 31 virtual void NetworkManagerChanged() OVERRIDE; | 33 virtual void NetworkManagerChanged() OVERRIDE; |
| 32 virtual void DefaultNetworkChanged() OVERRIDE; | 34 virtual void DefaultNetworkChanged(const NetworkState* network) OVERRIDE; |
| 33 | 35 |
| 34 // content::NotificationObserver overrides. | 36 // content::NotificationObserver overrides. |
| 35 virtual void Observe(int type, | 37 virtual void Observe(int type, |
| 36 const content::NotificationSource& source, | 38 const content::NotificationSource& source, |
| 37 const content::NotificationDetails& details) OVERRIDE; | 39 const content::NotificationDetails& details) OVERRIDE; |
| 38 | 40 |
| 39 bool IsNetworkConnected() const; | 41 bool IsNetworkConnected() const; |
| 40 net::URLRequestContextGetter* GetRequestContext() const; | 42 net::URLRequestContextGetter* GetRequestContext() const; |
| 41 void DoPrewarm(); | 43 void DoPrewarm(); |
| 42 | 44 |
| 43 content::NotificationRegistrar registrar_; | 45 content::NotificationRegistrar registrar_; |
| 44 base::Closure completion_callback_; | 46 base::Closure completion_callback_; |
| 45 bool doing_prewarm_; | 47 bool doing_prewarm_; |
| 46 | 48 |
| 47 DISALLOW_COPY_AND_ASSIGN(AuthPrewarmer); | 49 DISALLOW_COPY_AND_ASSIGN(AuthPrewarmer); |
| 48 }; | 50 }; |
| 49 | 51 |
| 50 } // namespace chromeos | 52 } // namespace chromeos |
| 51 | 53 |
| 52 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_PREWARMER_H_ | 54 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_PREWARMER_H_ |
| 53 | 55 |
| OLD | NEW |