Chromium Code Reviews| Index: chrome/browser/policy/cloud_policy_identity_strategy.h |
| diff --git a/chrome/browser/policy/cloud_policy_identity_strategy.h b/chrome/browser/policy/cloud_policy_identity_strategy.h |
| index 0b4e213bbb0aee3c4e1da5aede0d85f0bfdf7289..9d1f4df9993579a5e3d67a3ef893197c1b0b5379 100644 |
| --- a/chrome/browser/policy/cloud_policy_identity_strategy.h |
| +++ b/chrome/browser/policy/cloud_policy_identity_strategy.h |
| @@ -9,6 +9,7 @@ |
| #include <string> |
| #include "base/observer_list.h" |
| +#include "chrome/browser/policy/cloud_policy_data.h" |
| #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
| namespace policy { |
| @@ -19,71 +20,21 @@ namespace em = enterprise_management; |
| // registration with the device management service, and the associated |
| // credentials. Responsibilities include storing and loading the token from |
| // disk, observing and triggering relevant notifications. |
| -class CloudPolicyIdentityStrategy { |
| +class CloudPolicyIdentityStrategy : public CloudPolicyData::Observer { |
| public: |
| - class Observer { |
| - public: |
| - virtual ~Observer() {} |
| - |
| - // Notifies observers that the effective token for fetching policy has |
| - // changed. The token can be queried by calling GetDeviceToken(). |
| - virtual void OnDeviceTokenChanged() = 0; |
| - |
| - // Authentication credentials for talking to the device management service |
| - // changed. New auth data is available through GetCredentials(). |
| - virtual void OnCredentialsChanged() = 0; |
| - }; |
| - |
| - CloudPolicyIdentityStrategy(); |
| + explicit CloudPolicyIdentityStrategy(CloudPolicyData* data); |
| virtual ~CloudPolicyIdentityStrategy(); |
| - void AddObserver(Observer* obs); |
| - void RemoveObserver(Observer* obs); |
| - |
| - // Returns the device management token, if available. Returns the empty string |
| - // if the device token is currently unavailable. |
| - virtual std::string GetDeviceToken() = 0; |
| - |
| - // Returns the device ID for this device. This is a unique identifier that is |
| - // randomly generated at registration time on the client side. It always has |
| - // to be sent along with the device token to the server. |
| - virtual std::string GetDeviceID() = 0; |
| - |
| - // Returns physical machine ID for this device. |
| - virtual std::string GetMachineID() = 0; |
| - |
| - // Returns physical machine model for this device. |
| - virtual std::string GetMachineModel() = 0; |
| - |
| - // Returns the policy type to be used for registering at the device management |
| - // server. |
| - virtual em::DeviceRegisterRequest_Type GetPolicyRegisterType() = 0; |
| - |
| - // Returns the policy type to be used for requesting policies from the device |
| - // management server. |
| - virtual std::string GetPolicyType() = 0; |
| - |
| - // Retrieves authentication credentials to use when talking to the device |
| - // management service. Returns true if the data is available and writes the |
| - // values to the provided pointers. |
| - virtual bool GetCredentials(std::string* username, |
| - std::string* auth_token) = 0; |
| - |
| - // Notifies the identity strategy that a new token has been fetched. It is up |
| - // to the identity strategy to store the token, decide whether it is going |
| - // to be used, send out an appropriate OnDeviceTokenChanged() notification |
| - // and return the new token in GetDeviceToken() calls. |
| - virtual void OnDeviceTokenAvailable(const std::string& token) = 0; |
| + // CloudPolicyData::Observer implementation: |
| + virtual void OnDeviceTokenChanged() OVERRIDE; |
| + virtual void OnCredentialsChanged() OVERRIDE; |
| + virtual void OnPolicyHolderGoingAway() OVERRIDE {} |
|
pastarmovj
2011/07/06 12:11:57
Consider removing this.
gfeher
2011/07/06 15:14:20
Done.
|
| protected: |
| - // Notify observers that the effective token has changed. |
| - void NotifyDeviceTokenChanged(); |
| - |
| - // Notify observers about authentication data change. |
| - void NotifyAuthChanged(); |
| + CloudPolicyData* data(); |
| private: |
| - ObserverList<Observer, true> observer_list_; |
| + CloudPolicyData* data_; |
| DISALLOW_COPY_AND_ASSIGN(CloudPolicyIdentityStrategy); |
| }; |