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_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_FACTORY_H_ |
6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_FACTORY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_FACTORY_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 | 12 |
13 namespace chromeos { | 13 namespace chromeos { |
14 | 14 |
15 class DeviceOAuth2TokenService; | 15 class DeviceOAuth2TokenService; |
16 | 16 |
17 class DeviceOAuth2TokenServiceFactory { | 17 class DeviceOAuth2TokenServiceFactory { |
18 public: | 18 public: |
19 // Returns the instance of the DeviceOAuth2TokenService singleton. May return | 19 // Returns the instance of the DeviceOAuth2TokenService singleton. May return |
20 // NULL during browser startup and shutdown. When calling Get(), either make | 20 // NULL during browser startup and shutdown. When calling Get(), either make |
21 // sure that your code executes after browser startup and before shutdown or | 21 // sure that your code executes after browser startup and before shutdown or |
22 // be careful to call Get() every time (instead of holding a pointer) and | 22 // be careful to call Get() every time (instead of holding a pointer) and |
23 // check for NULL to handle cases where you might access | 23 // check for NULL to handle cases where you might access |
24 // DeviceOAuth2TokenService during startup or shutdown. | 24 // DeviceOAuth2TokenService during startup or shutdown. |
25 static DeviceOAuth2TokenService* Get(); | 25 static DeviceOAuth2TokenService* Get(); |
26 | 26 |
27 // Called by ChromeBrowserMainPartsChromeOS in order to bootstrap the | 27 // Called by ChromeBrowserMainPartsChromeOS in order to bootstrap the |
28 // DeviceOAuth2TokenService instance after the required global data is | 28 // DeviceOAuth2TokenService instance after the required global data is |
29 // available (local state and request context getter). | 29 // available (local state, request context getter and CrosSettings). |
30 static void Initialize(); | 30 static void Initialize(); |
31 | 31 |
32 // Called by ChromeBrowserMainPartsChromeOS in order to shutdown the | 32 // Called by ChromeBrowserMainPartsChromeOS in order to shutdown the |
33 // DeviceOAuth2TokenService instance and cancel all in-flight requests before | 33 // DeviceOAuth2TokenService instance and cancel all in-flight requests before |
34 // the required global data is destroyed (local state and request context | 34 // the required global data is destroyed (local state, request context getter |
35 // getter). | 35 // and CrosSettings). |
36 static void Shutdown(); | 36 static void Shutdown(); |
37 | 37 |
38 private: | 38 private: |
39 DeviceOAuth2TokenServiceFactory(); | 39 DeviceOAuth2TokenServiceFactory(); |
40 ~DeviceOAuth2TokenServiceFactory(); | 40 ~DeviceOAuth2TokenServiceFactory(); |
41 | 41 |
42 DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenServiceFactory); | 42 DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenServiceFactory); |
43 }; | 43 }; |
44 | 44 |
45 } // namespace chromeos | 45 } // namespace chromeos |
46 | 46 |
47 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_FACTORY_
H_ | 47 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_FACTORY_
H_ |
OLD | NEW |