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

Unified Diff: chrome/browser/policy/user_policy_identity_strategy.h

Issue 7147015: Move user cloud policy to BrowserProcess (was 6979011) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit_test include breakage Created 9 years, 6 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/policy/user_policy_identity_strategy.h
diff --git a/chrome/browser/policy/user_policy_identity_strategy.h b/chrome/browser/policy/user_policy_identity_strategy.h
index c90011efd3a931165ee6c594a8e5f56771c59b32..05b9e8a9bea918358d36f6b2e95d685ea5b8da46 100644
--- a/chrome/browser/policy/user_policy_identity_strategy.h
+++ b/chrome/browser/policy/user_policy_identity_strategy.h
@@ -14,28 +14,26 @@
#include "base/memory/weak_ptr.h"
#include "chrome/browser/policy/cloud_policy_identity_strategy.h"
#include "chrome/browser/policy/user_policy_token_cache.h"
-#include "content/common/notification_observer.h"
-#include "content/common/notification_registrar.h"
-
-class Profile;
namespace policy {
class DeviceManagementBackend;
// A token provider implementation that provides a user device token for the
-// user corresponding to a given profile.
+// user corresponding to given credentials.
class UserPolicyIdentityStrategy : public CloudPolicyIdentityStrategy,
- public NotificationObserver,
public UserPolicyTokenCache::Delegate {
public:
- UserPolicyIdentityStrategy(Profile* profile,
+ UserPolicyIdentityStrategy(const std::string& user_name,
const FilePath& token_cache_file);
virtual ~UserPolicyIdentityStrategy();
// Start loading the token cache.
void LoadTokenCache();
+ // Set a newly arriving auth_token and maybe trigger a fetch.
+ void SetAuthToken(const std::string& auth_token);
+
// CloudPolicyIdentityStrategy implementation:
virtual std::string GetDeviceToken() OVERRIDE;
virtual std::string GetDeviceID() OVERRIDE;
@@ -59,25 +57,25 @@ class UserPolicyIdentityStrategy : public CloudPolicyIdentityStrategy,
virtual void OnTokenCacheLoaded(const std::string& token,
const std::string& device_id) OVERRIDE;
- // NotificationObserver method overrides:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details) OVERRIDE;
-
- // The profile this provider is associated with.
- Profile* profile_;
-
// Keeps the on-disk copy of the token.
scoped_refptr<UserPolicyTokenCache> cache_;
+ // false until cache_ reports being loaded for the first time, true
+ // afterwards.
+ bool cache_loaded_;
+
// The device ID we use.
std::string device_id_;
// Current device token. Empty if not available.
std::string device_token_;
- // Registers the provider for notification of successful Gaia logins.
- NotificationRegistrar registrar_;
+ // Current auth token. Empty if not available.
+ std::string auth_token_;
+
+ // Current user name. Empty if not available. This is set on creation and not
+ // changed afterwards.
+ std::string user_name_;
// Allows to construct weak ptrs.
base::WeakPtrFactory<UserPolicyTokenCache::Delegate> weak_ptr_factory_;
« no previous file with comments | « chrome/browser/policy/user_policy_cache_unittest.cc ('k') | chrome/browser/policy/user_policy_identity_strategy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698