| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 namespace net { | 30 namespace net { |
| 31 class URLRequestContextGetter; | 31 class URLRequestContextGetter; |
| 32 } | 32 } |
| 33 | 33 |
| 34 namespace policy { | 34 namespace policy { |
| 35 | 35 |
| 36 class CloudExternalDataManager; | 36 class CloudExternalDataManager; |
| 37 class DeviceManagementService; | 37 class DeviceManagementService; |
| 38 class PolicyOAuth2TokenFetcher; | 38 class PolicyOAuth2TokenFetcher; |
| 39 class WildcardLoginChecker; |
| 39 | 40 |
| 40 // UserCloudPolicyManagerChromeOS implements logic for initializing user policy | 41 // UserCloudPolicyManagerChromeOS implements logic for initializing user policy |
| 41 // on Chrome OS. | 42 // on Chrome OS. |
| 42 class UserCloudPolicyManagerChromeOS | 43 class UserCloudPolicyManagerChromeOS |
| 43 : public CloudPolicyManager, | 44 : public CloudPolicyManager, |
| 44 public CloudPolicyClient::Observer, | 45 public CloudPolicyClient::Observer, |
| 45 public CloudPolicyService::Observer, | 46 public CloudPolicyService::Observer, |
| 46 public BrowserContextKeyedService { | 47 public BrowserContextKeyedService { |
| 47 public: | 48 public: |
| 48 // If |wait_for_policy_fetch| is true, IsInitializationComplete() will return | 49 // If |wait_for_policy_fetch| is true, IsInitializationComplete() will return |
| (...skipping 29 matching lines...) Expand all Loading... |
| 78 // the ProfileOAuth2TokenService directly to get the access token, a 3rd | 79 // the ProfileOAuth2TokenService directly to get the access token, a 3rd |
| 79 // service (UserCloudPolicyTokenForwarder) will fetch it later and pass it | 80 // service (UserCloudPolicyTokenForwarder) will fetch it later and pass it |
| 80 // to this method once available. | 81 // to this method once available. |
| 81 // The |access_token| can then be used to authenticate the registration | 82 // The |access_token| can then be used to authenticate the registration |
| 82 // request to the DMServer. | 83 // request to the DMServer. |
| 83 void OnAccessTokenAvailable(const std::string& access_token); | 84 void OnAccessTokenAvailable(const std::string& access_token); |
| 84 | 85 |
| 85 // Returns true if the underlying CloudPolicyClient is already registered. | 86 // Returns true if the underlying CloudPolicyClient is already registered. |
| 86 bool IsClientRegistered() const; | 87 bool IsClientRegistered() const; |
| 87 | 88 |
| 89 // Indicates a wildcard login check should be performed once an access token |
| 90 // is available. |
| 91 void EnableWildcardLoginCheck(const std::string& username); |
| 92 |
| 88 // ConfigurationPolicyProvider: | 93 // ConfigurationPolicyProvider: |
| 89 virtual void Shutdown() OVERRIDE; | 94 virtual void Shutdown() OVERRIDE; |
| 90 virtual bool IsInitializationComplete(PolicyDomain domain) const OVERRIDE; | 95 virtual bool IsInitializationComplete(PolicyDomain domain) const OVERRIDE; |
| 91 | 96 |
| 92 // CloudPolicyService::Observer: | 97 // CloudPolicyService::Observer: |
| 93 virtual void OnInitializationCompleted(CloudPolicyService* service) OVERRIDE; | 98 virtual void OnInitializationCompleted(CloudPolicyService* service) OVERRIDE; |
| 94 | 99 |
| 95 // CloudPolicyClient::Observer: | 100 // CloudPolicyClient::Observer: |
| 96 virtual void OnPolicyFetched(CloudPolicyClient* client) OVERRIDE; | 101 virtual void OnPolicyFetched(CloudPolicyClient* client) OVERRIDE; |
| 97 virtual void OnRegistrationStateChanged(CloudPolicyClient* client) OVERRIDE; | 102 virtual void OnRegistrationStateChanged(CloudPolicyClient* client) OVERRIDE; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 125 void CancelWaitForPolicyFetch(); | 130 void CancelWaitForPolicyFetch(); |
| 126 | 131 |
| 127 void StartRefreshSchedulerIfReady(); | 132 void StartRefreshSchedulerIfReady(); |
| 128 | 133 |
| 129 // Owns the store, note that CloudPolicyManager just keeps a plain pointer. | 134 // Owns the store, note that CloudPolicyManager just keeps a plain pointer. |
| 130 scoped_ptr<CloudPolicyStore> store_; | 135 scoped_ptr<CloudPolicyStore> store_; |
| 131 | 136 |
| 132 // Manages external data referenced by policies. | 137 // Manages external data referenced by policies. |
| 133 scoped_ptr<CloudExternalDataManager> external_data_manager_; | 138 scoped_ptr<CloudExternalDataManager> external_data_manager_; |
| 134 | 139 |
| 140 // Username for the wildcard login check if applicable, empty otherwise. |
| 141 std::string wildcard_username_; |
| 142 |
| 135 // Path where policy for components will be cached. | 143 // Path where policy for components will be cached. |
| 136 base::FilePath component_policy_cache_path_; | 144 base::FilePath component_policy_cache_path_; |
| 137 | 145 |
| 138 // Whether to wait for a policy fetch to complete before reporting | 146 // Whether to wait for a policy fetch to complete before reporting |
| 139 // IsInitializationComplete(). | 147 // IsInitializationComplete(). |
| 140 bool wait_for_policy_fetch_; | 148 bool wait_for_policy_fetch_; |
| 141 | 149 |
| 142 // A timer that puts a hard limit on the maximum time to wait for the intial | 150 // A timer that puts a hard limit on the maximum time to wait for the intial |
| 143 // policy fetch. | 151 // policy fetch. |
| 144 base::Timer policy_fetch_timeout_; | 152 base::Timer policy_fetch_timeout_; |
| 145 | 153 |
| 146 // The pref service to pass to the refresh scheduler on initialization. | 154 // The pref service to pass to the refresh scheduler on initialization. |
| 147 PrefService* local_state_; | 155 PrefService* local_state_; |
| 148 | 156 |
| 149 // Used to fetch the policy OAuth token, when necessary. This object holds | 157 // Used to fetch the policy OAuth token, when necessary. This object holds |
| 150 // a callback with an unretained reference to the manager, when it exists. | 158 // a callback with an unretained reference to the manager, when it exists. |
| 151 scoped_ptr<PolicyOAuth2TokenFetcher> token_fetcher_; | 159 scoped_ptr<PolicyOAuth2TokenFetcher> token_fetcher_; |
| 152 | 160 |
| 161 // Keeps alive the wildcard checker while its running. |
| 162 scoped_ptr<WildcardLoginChecker> wildcard_login_checker_; |
| 163 |
| 153 // The access token passed to OnAccessTokenAvailable. It is stored here so | 164 // The access token passed to OnAccessTokenAvailable. It is stored here so |
| 154 // that it can be used if OnInitializationCompleted is called later. | 165 // that it can be used if OnInitializationCompleted is called later. |
| 155 std::string access_token_; | 166 std::string access_token_; |
| 156 | 167 |
| 157 // Timestamps for collecting timing UMA stats. | 168 // Timestamps for collecting timing UMA stats. |
| 158 base::Time time_init_started_; | 169 base::Time time_init_started_; |
| 159 base::Time time_init_completed_; | 170 base::Time time_init_completed_; |
| 160 base::Time time_token_available_; | 171 base::Time time_token_available_; |
| 161 base::Time time_client_registered_; | 172 base::Time time_client_registered_; |
| 162 | 173 |
| 163 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOS); | 174 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOS); |
| 164 }; | 175 }; |
| 165 | 176 |
| 166 } // namespace policy | 177 } // namespace policy |
| 167 | 178 |
| 168 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ | 179 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ |
| OLD | NEW |