Index: chrome/browser/policy/cros_user_policy_identity_strategy.h |
diff --git a/chrome/browser/policy/user_policy_identity_strategy.h b/chrome/browser/policy/cros_user_policy_identity_strategy.h |
similarity index 54% |
copy from chrome/browser/policy/user_policy_identity_strategy.h |
copy to chrome/browser/policy/cros_user_policy_identity_strategy.h |
index c90011efd3a931165ee6c594a8e5f56771c59b32..460e39a87315dfa4f2165c69629ff9994b0641b8 100644 |
--- a/chrome/browser/policy/user_policy_identity_strategy.h |
+++ b/chrome/browser/policy/cros_user_policy_identity_strategy.h |
@@ -2,18 +2,14 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CHROME_BROWSER_POLICY_USER_POLICY_IDENTITY_STRATEGY_H_ |
-#define CHROME_BROWSER_POLICY_USER_POLICY_IDENTITY_STRATEGY_H_ |
+#ifndef CHROME_BROWSER_POLICY_CROS_USER_POLICY_IDENTITY_STRATEGY_H_ |
+#define CHROME_BROWSER_POLICY_CROS_USER_POLICY_IDENTITY_STRATEGY_H_ |
#pragma once |
#include <string> |
-#include "base/compiler_specific.h" |
#include "base/file_path.h" |
-#include "base/memory/ref_counted.h" |
-#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" |
@@ -23,18 +19,23 @@ namespace policy { |
class DeviceManagementBackend; |
-// A token provider implementation that provides a user device token for the |
-// user corresponding to a given profile. |
-class UserPolicyIdentityStrategy : public CloudPolicyIdentityStrategy, |
- public NotificationObserver, |
- public UserPolicyTokenCache::Delegate { |
+// User policy identity strategy for ChromeOS user policy. Unlike the generic |
+// implementation, it does not keep its own cache but relies on external |
+// entities to cache the device credentials. This is usually done by |
+// CrosUserPolicyCache. |
+class CrosUserPolicyIdentityStrategy : public CloudPolicyIdentityStrategy, |
+ public NotificationObserver { |
public: |
- UserPolicyIdentityStrategy(Profile* profile, |
- const FilePath& token_cache_file); |
- virtual ~UserPolicyIdentityStrategy(); |
+ explicit CrosUserPolicyIdentityStrategy(Profile* profile); |
+ virtual ~CrosUserPolicyIdentityStrategy(); |
- // Start loading the token cache. |
- void LoadTokenCache(); |
+ // Sets device ID and token and announces its availablility. |
+ void SetDeviceCredentials(const std::string& device_id, |
+ const std::string& token); |
gfeher
2011/06/22 12:41:31
Is this the device's dmtoken or the user's dmtoken
Mattias Nissler (ping if slow)
2011/06/22 17:17:35
It's the user token. I thought that's obvious sinc
|
+ |
+ // Allows the identity strategy to register when the required data becomes |
+ // available. |
+ void EnableRegistration(); |
// CloudPolicyIdentityStrategy implementation: |
virtual std::string GetDeviceToken() OVERRIDE; |
@@ -55,21 +56,17 @@ class UserPolicyIdentityStrategy : public CloudPolicyIdentityStrategy, |
// Gets the current user. |
std::string GetCurrentUser(); |
- // Called from the token cache when the token has been loaded. |
- 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; |
+ const NotificationDetails& details); |
+ |
+ // Whether the to try and register when credentials are available. |
+ bool should_register_; |
// The profile this provider is associated with. |
Profile* profile_; |
- // Keeps the on-disk copy of the token. |
- scoped_refptr<UserPolicyTokenCache> cache_; |
- |
// The device ID we use. |
std::string device_id_; |
@@ -79,12 +76,9 @@ class UserPolicyIdentityStrategy : public CloudPolicyIdentityStrategy, |
// Registers the provider for notification of successful Gaia logins. |
NotificationRegistrar registrar_; |
- // Allows to construct weak ptrs. |
- base::WeakPtrFactory<UserPolicyTokenCache::Delegate> weak_ptr_factory_; |
- |
- DISALLOW_COPY_AND_ASSIGN(UserPolicyIdentityStrategy); |
+ DISALLOW_COPY_AND_ASSIGN(CrosUserPolicyIdentityStrategy); |
}; |
} // namespace policy |
-#endif // CHROME_BROWSER_POLICY_USER_POLICY_IDENTITY_STRATEGY_H_ |
+#endif // CHROME_BROWSER_POLICY_CROS_USER_POLICY_IDENTITY_STRATEGY_H_ |