| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // |task_runner| is the runner for policy refresh tasks. | 50 // |task_runner| is the runner for policy refresh tasks. |
| 51 // |file_task_runner| is used for file operations. Currently this must be the | 51 // |file_task_runner| is used for file operations. Currently this must be the |
| 52 // FILE BrowserThread. | 52 // FILE BrowserThread. |
| 53 // |io_task_runner| is used for network IO. Currently this must be the IO | 53 // |io_task_runner| is used for network IO. Currently this must be the IO |
| 54 // BrowserThread. | 54 // BrowserThread. |
| 55 UserCloudPolicyManagerChromeOS( | 55 UserCloudPolicyManagerChromeOS( |
| 56 scoped_ptr<CloudPolicyStore> store, | 56 scoped_ptr<CloudPolicyStore> store, |
| 57 scoped_ptr<CloudExternalDataManager> external_data_manager, | 57 scoped_ptr<CloudExternalDataManager> external_data_manager, |
| 58 const base::FilePath& component_policy_cache_path, | 58 const base::FilePath& component_policy_cache_path, |
| 59 bool wait_for_policy_fetch, | 59 bool wait_for_policy_fetch, |
| 60 const std::string& refresh_token, |
| 60 base::TimeDelta initial_policy_fetch_timeout, | 61 base::TimeDelta initial_policy_fetch_timeout, |
| 61 const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 62 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
| 62 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner, | 63 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner, |
| 63 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner); | 64 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner); |
| 64 ~UserCloudPolicyManagerChromeOS() override; | 65 ~UserCloudPolicyManagerChromeOS() override; |
| 65 | 66 |
| 66 // Initializes the cloud connection. |local_state| and | 67 // Initializes the cloud connection. |local_state| and |
| 67 // |device_management_service| must stay valid until this object is deleted. | 68 // |device_management_service| must stay valid until this object is deleted. |
| 68 void Connect( | 69 void Connect( |
| 69 PrefService* local_state, | 70 PrefService* local_state, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 void OnClientError(CloudPolicyClient* client) override; | 103 void OnClientError(CloudPolicyClient* client) override; |
| 103 | 104 |
| 104 // ComponentCloudPolicyService::Delegate: | 105 // ComponentCloudPolicyService::Delegate: |
| 105 void OnComponentCloudPolicyUpdated() override; | 106 void OnComponentCloudPolicyUpdated() override; |
| 106 | 107 |
| 107 protected: | 108 protected: |
| 108 // CloudPolicyManager: | 109 // CloudPolicyManager: |
| 109 void GetChromePolicy(PolicyMap* policy_map) override; | 110 void GetChromePolicy(PolicyMap* policy_map) override; |
| 110 | 111 |
| 111 private: | 112 private: |
| 112 // Fetches a policy token using the authentication context of the signin | 113 // Fetches a policy token using the refresh token if available, or the |
| 113 // context, and calls back to OnOAuth2PolicyTokenFetched when done. | 114 // authentication context of the signin context, and calls back |
| 114 void FetchPolicyOAuthTokenUsingSigninContext(); | 115 // OnOAuth2PolicyTokenFetched when done. |
| 116 void FetchPolicyOAuthToken(); |
| 115 | 117 |
| 116 // Called once the policy access token is available, and starts the | 118 // Called once the policy access token is available, and starts the |
| 117 // registration with the policy server if the token was successfully fetched. | 119 // registration with the policy server if the token was successfully fetched. |
| 118 void OnOAuth2PolicyTokenFetched(const std::string& policy_token, | 120 void OnOAuth2PolicyTokenFetched(const std::string& policy_token, |
| 119 const GoogleServiceAuthError& error); | 121 const GoogleServiceAuthError& error); |
| 120 | 122 |
| 121 // Completion handler for the explicit policy fetch triggered on startup in | 123 // Completion handler for the explicit policy fetch triggered on startup in |
| 122 // case |wait_for_policy_fetch_| is true. |success| is true if the fetch was | 124 // case |wait_for_policy_fetch_| is true. |success| is true if the fetch was |
| 123 // successful. | 125 // successful. |
| 124 void OnInitialPolicyFetchComplete(bool success); | 126 void OnInitialPolicyFetchComplete(bool success); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 143 // Username for the wildcard login check if applicable, empty otherwise. | 145 // Username for the wildcard login check if applicable, empty otherwise. |
| 144 std::string wildcard_username_; | 146 std::string wildcard_username_; |
| 145 | 147 |
| 146 // Path where policy for components will be cached. | 148 // Path where policy for components will be cached. |
| 147 base::FilePath component_policy_cache_path_; | 149 base::FilePath component_policy_cache_path_; |
| 148 | 150 |
| 149 // Whether to wait for a policy fetch to complete before reporting | 151 // Whether to wait for a policy fetch to complete before reporting |
| 150 // IsInitializationComplete(). | 152 // IsInitializationComplete(). |
| 151 bool wait_for_policy_fetch_; | 153 bool wait_for_policy_fetch_; |
| 152 | 154 |
| 155 // OAuth refresh token for fetching policy. |
| 156 std::string refresh_token_; |
| 157 |
| 153 // A timer that puts a hard limit on the maximum time to wait for the initial | 158 // A timer that puts a hard limit on the maximum time to wait for the initial |
| 154 // policy fetch. | 159 // policy fetch. |
| 155 base::Timer policy_fetch_timeout_; | 160 base::Timer policy_fetch_timeout_; |
| 156 | 161 |
| 157 // The pref service to pass to the refresh scheduler on initialization. | 162 // The pref service to pass to the refresh scheduler on initialization. |
| 158 PrefService* local_state_; | 163 PrefService* local_state_; |
| 159 | 164 |
| 160 // Used to fetch the policy OAuth token, when necessary. This object holds | 165 // Used to fetch the policy OAuth token, when necessary. This object holds |
| 161 // a callback with an unretained reference to the manager, when it exists. | 166 // a callback with an unretained reference to the manager, when it exists. |
| 162 scoped_ptr<PolicyOAuth2TokenFetcher> token_fetcher_; | 167 scoped_ptr<PolicyOAuth2TokenFetcher> token_fetcher_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 173 base::Time time_init_completed_; | 178 base::Time time_init_completed_; |
| 174 base::Time time_token_available_; | 179 base::Time time_token_available_; |
| 175 base::Time time_client_registered_; | 180 base::Time time_client_registered_; |
| 176 | 181 |
| 177 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOS); | 182 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOS); |
| 178 }; | 183 }; |
| 179 | 184 |
| 180 } // namespace policy | 185 } // namespace policy |
| 181 | 186 |
| 182 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ | 187 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ |
| OLD | NEW |