Index: chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h |
diff --git a/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h b/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h |
index f6c8637c2784cb01d6db84e38cbafce2a4ecebd0..16bd680ff573ea51f2d7f42dc6cc14e00cee16da 100644 |
--- a/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h |
+++ b/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h |
@@ -6,6 +6,7 @@ |
#define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_FACTORY_H_ |
#include "base/basictypes.h" |
+#include "base/callback_forward.h" |
namespace chromeos { |
@@ -13,12 +14,21 @@ class DeviceOAuth2TokenService; |
class DeviceOAuth2TokenServiceFactory { |
public: |
- // Returns the instance of the DeviceOAuth2TokenService singleton. |
- // May return null during browser startup and shutdown. Do not hold |
- // the pointer returned by this method; call this method every time |
- // and check for null to handle the case where this instance is destroyed |
- // during shutdown. |
- static DeviceOAuth2TokenService* Get(); |
+ // Callback type used for Get() function. |
+ typedef base::Callback<void(DeviceOAuth2TokenService*)> GetCallback; |
+ |
+ // Returns the instance of the DeviceOAuth2TokenService singleton via the |
+ // given callback. This function is asynchronous as initializing |
+ // DeviceOAuth2TokenService involves asynchronous D-Bus method calls. |
+ // |
+ // May return NULL during browser startup and shutdown. May also return |
+ // NULL if Initialize() is not called beforehand, which can happen in unit |
+ // tests. |
+ // |
+ // Do not hold the pointer returned by this method; call this method every |
+ // time and check for NULL to handle the case where this instance is |
+ // destroyed during shutdown. |
+ static void Get(const GetCallback& callback); |
// Called by ChromeBrowserMainPartsChromeOS in order to bootstrap the |
// DeviceOAuth2TokenService instance after the required global data is |
@@ -33,6 +43,9 @@ class DeviceOAuth2TokenServiceFactory { |
private: |
DeviceOAuth2TokenServiceFactory(); |
+ ~DeviceOAuth2TokenServiceFactory(); |
+ |
+ DeviceOAuth2TokenService* token_service_; |
DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenServiceFactory); |
}; |