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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_AUTH_PREWARMER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_AUTH_PREWARMER_H_
8 #include "base/basictypes.h"
9 #include "base/callback.h"
10 #include "chromeos/network/network_state_handler_observer.h"
11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h"
15 class URLRequestContextGetter
;
22 // Class for prewarming authentication network connection.
23 class AuthPrewarmer
: public NetworkStateHandlerObserver
,
24 public content::NotificationObserver
{
27 ~AuthPrewarmer() override
;
29 void PrewarmAuthentication(const base::Closure
& completion_callback
);
32 // chromeos::NetworkStateHandlerObserver overrides.
33 void DefaultNetworkChanged(const NetworkState
* network
) override
;
35 // content::NotificationObserver overrides.
36 void Observe(int type
,
37 const content::NotificationSource
& source
,
38 const content::NotificationDetails
& details
) override
;
40 bool IsNetworkConnected() const;
41 net::URLRequestContextGetter
* GetRequestContext() const;
44 content::NotificationRegistrar registrar_
;
45 base::Closure completion_callback_
;
48 DISALLOW_COPY_AND_ASSIGN(AuthPrewarmer
);
51 } // namespace chromeos
53 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_AUTH_PREWARMER_H_