Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Unified Diff: chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h

Issue 39443002: settings: Add async system salt retrieval logic in DeviceOAuth2TokenServiceFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add unit test Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 16bd680ff573ea51f2d7f42dc6cc14e00cee16da..7dc6e7ef4e13aa66a60557f1882a919dfc56764b 100644
--- a/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
+++ b/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
@@ -5,8 +5,12 @@
#ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_FACTORY_H_
#define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_FACTORY_H_
+#include <string>
+#include <vector>
+
#include "base/basictypes.h"
#include "base/callback_forward.h"
+#include "base/memory/weak_ptr.h"
namespace chromeos {
@@ -45,7 +49,25 @@ class DeviceOAuth2TokenServiceFactory {
DeviceOAuth2TokenServiceFactory();
~DeviceOAuth2TokenServiceFactory();
+ // Creates the token service asynchronously in the following steps:
+ // 1) Get the system salt from salt from cryptohomed asynchronously
hashimoto 2013/10/24 06:50:00 nit: Did you mean "the system salt from cryptohome
satorux1 2013/10/24 07:33:08 Done.
+ // 2) Create CryptohomeTokenEncryptor using the system salt
+ // 3) Create DeviceOAuth2TokenServiceFactory using the token encryptor
+ void CreateTokenService();
+
+ // Continuation of CreateTokenService(). Called when GetSystemSalt() is
+ // complete.
+ void DidGetSystemSalt(const std::string& system_salt);
+
+ // Runs the callback asynchronously. If |token_service_| is ready, the
+ // callback will be simply run via MessageLoop. Otherwise, the callback
+ // will be queued in |pending_callbacks_| and run when |token_service_| is
+ // ready.
+ void RunAsync(const GetCallback& callback);
+
DeviceOAuth2TokenService* token_service_;
+ std::vector<GetCallback> pending_callbacks_;
+ base::WeakPtrFactory<DeviceOAuth2TokenServiceFactory> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenServiceFactory);
};

Powered by Google App Engine
This is Rietveld 408576698