Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" | 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 #include "components/policy/policy_constants.h" | 36 #include "components/policy/policy_constants.h" |
| 37 #include "components/user_manager/user.h" | 37 #include "components/user_manager/user.h" |
| 38 #include "components/user_manager/user_manager.h" | 38 #include "components/user_manager/user_manager.h" |
| 39 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
| 40 #include "net/url_request/url_request_context_getter.h" | 40 #include "net/url_request/url_request_context_getter.h" |
| 41 | 41 |
| 42 namespace policy { | 42 namespace policy { |
| 43 | 43 |
| 44 namespace { | 44 namespace { |
| 45 | 45 |
| 46 // Subdirectory in the user's profile for storing legacy user policies. | 46 // Directory under the profile directory where policy-related resources are |
| 47 const base::FilePath::CharType kDeviceManagementDir[] = | 47 // stored, see the follow constants for details. |
|
Andrew T Wilson (Slow)
2016/11/08 15:50:40
nit: follow->following
| |
| 48 FILE_PATH_LITERAL("Device Management"); | |
| 49 | |
| 50 // File in the above directory for storing legacy user policy dmtokens. | |
| 51 const base::FilePath::CharType kToken[] = FILE_PATH_LITERAL("Token"); | |
| 52 | |
| 53 // This constant is used to build two different paths. It can be a file inside | |
| 54 // kDeviceManagementDir where legacy user policy data is stored, and it can be | |
| 55 // a directory inside the profile directory where other resources are stored. | |
| 56 const base::FilePath::CharType kPolicy[] = FILE_PATH_LITERAL("Policy"); | 48 const base::FilePath::CharType kPolicy[] = FILE_PATH_LITERAL("Policy"); |
| 57 | 49 |
| 58 // Directory under kPolicy, in the user's profile dir, where policy for | 50 // Directory under kPolicy, in the user's profile dir, where policy for |
| 59 // components is cached. | 51 // components is cached. |
| 60 const base::FilePath::CharType kComponentsDir[] = | 52 const base::FilePath::CharType kComponentsDir[] = |
| 61 FILE_PATH_LITERAL("Components"); | 53 FILE_PATH_LITERAL("Components"); |
| 62 | 54 |
| 63 // Directory in which to store external policy data. This is specified relative | 55 // Directory in which to store external policy data. This is specified relative |
| 64 // to kPolicy. | 56 // to kPolicy. |
| 65 const base::FilePath::CharType kPolicyExternalDataDir[] = | 57 const base::FilePath::CharType kPolicyExternalDataDir[] = |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 initial_policy_fetch_timeout = | 164 initial_policy_fetch_timeout = |
| 173 base::TimeDelta::FromSeconds(kInitialPolicyFetchTimeoutSeconds); | 165 base::TimeDelta::FromSeconds(kInitialPolicyFetchTimeoutSeconds); |
| 174 } | 166 } |
| 175 | 167 |
| 176 DeviceManagementService* device_management_service = | 168 DeviceManagementService* device_management_service = |
| 177 connector->device_management_service(); | 169 connector->device_management_service(); |
| 178 if (wait_for_policy_fetch) | 170 if (wait_for_policy_fetch) |
| 179 device_management_service->ScheduleInitialization(0); | 171 device_management_service->ScheduleInitialization(0); |
| 180 | 172 |
| 181 base::FilePath profile_dir = profile->GetPath(); | 173 base::FilePath profile_dir = profile->GetPath(); |
| 182 const base::FilePath legacy_dir = profile_dir.Append(kDeviceManagementDir); | |
| 183 const base::FilePath policy_cache_file = legacy_dir.Append(kPolicy); | |
| 184 const base::FilePath token_cache_file = legacy_dir.Append(kToken); | |
| 185 const base::FilePath component_policy_cache_dir = | 174 const base::FilePath component_policy_cache_dir = |
| 186 profile_dir.Append(kPolicy).Append(kComponentsDir); | 175 profile_dir.Append(kPolicy).Append(kComponentsDir); |
| 187 const base::FilePath external_data_dir = | 176 const base::FilePath external_data_dir = |
| 188 profile_dir.Append(kPolicy).Append(kPolicyExternalDataDir); | 177 profile_dir.Append(kPolicy).Append(kPolicyExternalDataDir); |
| 189 base::FilePath policy_key_dir; | 178 base::FilePath policy_key_dir; |
| 190 CHECK(PathService::Get(chromeos::DIR_USER_POLICY_KEYS, &policy_key_dir)); | 179 CHECK(PathService::Get(chromeos::DIR_USER_POLICY_KEYS, &policy_key_dir)); |
| 191 | 180 |
| 192 std::unique_ptr<UserCloudPolicyStoreChromeOS> store( | 181 std::unique_ptr<UserCloudPolicyStoreChromeOS> store( |
| 193 new UserCloudPolicyStoreChromeOS( | 182 new UserCloudPolicyStoreChromeOS( |
| 194 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(), | 183 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(), |
| 195 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), | 184 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), |
| 196 background_task_runner, account_id, policy_key_dir, token_cache_file, | 185 background_task_runner, account_id, policy_key_dir)); |
| 197 policy_cache_file)); | |
| 198 | 186 |
| 199 scoped_refptr<base::SequencedTaskRunner> backend_task_runner = | 187 scoped_refptr<base::SequencedTaskRunner> backend_task_runner = |
| 200 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( | 188 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( |
| 201 content::BrowserThread::GetBlockingPool()->GetSequenceToken()); | 189 content::BrowserThread::GetBlockingPool()->GetSequenceToken()); |
| 202 scoped_refptr<base::SequencedTaskRunner> io_task_runner = | 190 scoped_refptr<base::SequencedTaskRunner> io_task_runner = |
| 203 content::BrowserThread::GetTaskRunnerForThread( | 191 content::BrowserThread::GetTaskRunnerForThread( |
| 204 content::BrowserThread::IO); | 192 content::BrowserThread::IO); |
| 205 std::unique_ptr<CloudExternalDataManager> external_data_manager( | 193 std::unique_ptr<CloudExternalDataManager> external_data_manager( |
| 206 new UserCloudExternalDataManager(base::Bind(&GetChromePolicyDetails), | 194 new UserCloudExternalDataManager(base::Bind(&GetChromePolicyDetails), |
| 207 backend_task_runner, io_task_runner, | 195 backend_task_runner, io_task_runner, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 | 249 |
| 262 bool UserCloudPolicyManagerFactoryChromeOS::HasTestingFactory( | 250 bool UserCloudPolicyManagerFactoryChromeOS::HasTestingFactory( |
| 263 content::BrowserContext* context) { | 251 content::BrowserContext* context) { |
| 264 return false; | 252 return false; |
| 265 } | 253 } |
| 266 | 254 |
| 267 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( | 255 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( |
| 268 content::BrowserContext* context) {} | 256 content::BrowserContext* context) {} |
| 269 | 257 |
| 270 } // namespace policy | 258 } // namespace policy |
| OLD | NEW |