| 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_DEVICE_LOCAL_ACCOUNT_POLICY_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_SERVICE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
| 9 #include <set> | 10 #include <set> |
| 10 #include <string> | 11 #include <string> |
| 11 | 12 |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 14 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/scoped_ptr.h" | |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
| 20 #include "chrome/browser/chromeos/extensions/device_local_account_external_polic
y_loader.h" | 20 #include "chrome/browser/chromeos/extensions/device_local_account_external_polic
y_loader.h" |
| 21 #include "chrome/browser/chromeos/policy/device_local_account_extension_tracker.
h" | 21 #include "chrome/browser/chromeos/policy/device_local_account_extension_tracker.
h" |
| 22 #include "chrome/browser/chromeos/policy/device_local_account_external_data_mana
ger.h" | 22 #include "chrome/browser/chromeos/policy/device_local_account_external_data_mana
ger.h" |
| 23 #include "chrome/browser/chromeos/settings/cros_settings.h" | 23 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 24 #include "components/policy/core/common/cloud/cloud_policy_core.h" | 24 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
| 25 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 25 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 26 #include "components/policy/core/common/cloud/component_cloud_policy_service.h" | 26 #include "components/policy/core/common/cloud/component_cloud_policy_service.h" |
| 27 #include "components/policy/core/common/schema_registry.h" | 27 #include "components/policy/core/common/schema_registry.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 54 : public CloudPolicyStore::Observer, | 54 : public CloudPolicyStore::Observer, |
| 55 public ComponentCloudPolicyService::Delegate { | 55 public ComponentCloudPolicyService::Delegate { |
| 56 public: | 56 public: |
| 57 // |invalidation_service_provider| must outlive |this|. | 57 // |invalidation_service_provider| must outlive |this|. |
| 58 // |policy_update_callback| will be invoked to notify observers that the | 58 // |policy_update_callback| will be invoked to notify observers that the |
| 59 // policy for |account| has been updated. | 59 // policy for |account| has been updated. |
| 60 // |task_runner| is the runner for policy refresh tasks. | 60 // |task_runner| is the runner for policy refresh tasks. |
| 61 DeviceLocalAccountPolicyBroker( | 61 DeviceLocalAccountPolicyBroker( |
| 62 const DeviceLocalAccount& account, | 62 const DeviceLocalAccount& account, |
| 63 const base::FilePath& component_policy_cache_path, | 63 const base::FilePath& component_policy_cache_path, |
| 64 scoped_ptr<DeviceLocalAccountPolicyStore> store, | 64 std::unique_ptr<DeviceLocalAccountPolicyStore> store, |
| 65 scoped_refptr<DeviceLocalAccountExternalDataManager> | 65 scoped_refptr<DeviceLocalAccountExternalDataManager> |
| 66 external_data_manager, | 66 external_data_manager, |
| 67 const base::Closure& policy_updated_callback, | 67 const base::Closure& policy_updated_callback, |
| 68 const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 68 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
| 69 AffiliatedInvalidationServiceProvider* invalidation_service_provider); | 69 AffiliatedInvalidationServiceProvider* invalidation_service_provider); |
| 70 ~DeviceLocalAccountPolicyBroker() override; | 70 ~DeviceLocalAccountPolicyBroker() override; |
| 71 | 71 |
| 72 // Initialize the broker, loading its |store_|. | 72 // Initialize the broker, loading its |store_|. |
| 73 void Initialize(); | 73 void Initialize(); |
| 74 | 74 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 private: | 119 private: |
| 120 void CreateComponentCloudPolicyService( | 120 void CreateComponentCloudPolicyService( |
| 121 const scoped_refptr<net::URLRequestContextGetter>& request_context, | 121 const scoped_refptr<net::URLRequestContextGetter>& request_context, |
| 122 CloudPolicyClient* client); | 122 CloudPolicyClient* client); |
| 123 | 123 |
| 124 AffiliatedInvalidationServiceProvider* const invalidation_service_provider_; | 124 AffiliatedInvalidationServiceProvider* const invalidation_service_provider_; |
| 125 const std::string account_id_; | 125 const std::string account_id_; |
| 126 const std::string user_id_; | 126 const std::string user_id_; |
| 127 const base::FilePath component_policy_cache_path_; | 127 const base::FilePath component_policy_cache_path_; |
| 128 SchemaRegistry schema_registry_; | 128 SchemaRegistry schema_registry_; |
| 129 const scoped_ptr<DeviceLocalAccountPolicyStore> store_; | 129 const std::unique_ptr<DeviceLocalAccountPolicyStore> store_; |
| 130 DeviceLocalAccountExtensionTracker extension_tracker_; | 130 DeviceLocalAccountExtensionTracker extension_tracker_; |
| 131 scoped_refptr<DeviceLocalAccountExternalDataManager> external_data_manager_; | 131 scoped_refptr<DeviceLocalAccountExternalDataManager> external_data_manager_; |
| 132 scoped_refptr<chromeos::DeviceLocalAccountExternalPolicyLoader> | 132 scoped_refptr<chromeos::DeviceLocalAccountExternalPolicyLoader> |
| 133 extension_loader_; | 133 extension_loader_; |
| 134 CloudPolicyCore core_; | 134 CloudPolicyCore core_; |
| 135 scoped_ptr<ComponentCloudPolicyService> component_policy_service_; | 135 std::unique_ptr<ComponentCloudPolicyService> component_policy_service_; |
| 136 base::Closure policy_update_callback_; | 136 base::Closure policy_update_callback_; |
| 137 scoped_ptr<AffiliatedCloudPolicyInvalidator> invalidator_; | 137 std::unique_ptr<AffiliatedCloudPolicyInvalidator> invalidator_; |
| 138 | 138 |
| 139 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyBroker); | 139 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyBroker); |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 // Manages user policy blobs for device-local accounts present on the device. | 142 // Manages user policy blobs for device-local accounts present on the device. |
| 143 // The actual policy blobs are brokered by session_manager (to prevent file | 143 // The actual policy blobs are brokered by session_manager (to prevent file |
| 144 // manipulation), and we're making signature checks on the policy blobs to | 144 // manipulation), and we're making signature checks on the policy blobs to |
| 145 // ensure they're issued by the device owner. | 145 // ensure they're issued by the device owner. |
| 146 class DeviceLocalAccountPolicyService { | 146 class DeviceLocalAccountPolicyService { |
| 147 public: | 147 public: |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 OrphanExtensionCacheDeletionState orphan_extension_cache_deletion_state_; | 257 OrphanExtensionCacheDeletionState orphan_extension_cache_deletion_state_; |
| 258 | 258 |
| 259 // Account IDs whose extension cache directories are busy, either because a | 259 // Account IDs whose extension cache directories are busy, either because a |
| 260 // broker for the account has not shut down completely yet or because the | 260 // broker for the account has not shut down completely yet or because the |
| 261 // directory is being deleted. | 261 // directory is being deleted. |
| 262 std::set<std::string> busy_extension_cache_directories_; | 262 std::set<std::string> busy_extension_cache_directories_; |
| 263 | 263 |
| 264 const scoped_refptr<base::SequencedTaskRunner> store_background_task_runner_; | 264 const scoped_refptr<base::SequencedTaskRunner> store_background_task_runner_; |
| 265 const scoped_refptr<base::SequencedTaskRunner> extension_cache_task_runner_; | 265 const scoped_refptr<base::SequencedTaskRunner> extension_cache_task_runner_; |
| 266 | 266 |
| 267 scoped_ptr<DeviceLocalAccountExternalDataService> external_data_service_; | 267 std::unique_ptr<DeviceLocalAccountExternalDataService> external_data_service_; |
| 268 | 268 |
| 269 scoped_refptr<net::URLRequestContextGetter> request_context_; | 269 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 270 | 270 |
| 271 const scoped_ptr<chromeos::CrosSettings::ObserverSubscription> | 271 const std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
| 272 local_accounts_subscription_; | 272 local_accounts_subscription_; |
| 273 | 273 |
| 274 // Path to the directory that contains the cached policy for components | 274 // Path to the directory that contains the cached policy for components |
| 275 // for device-local accounts. | 275 // for device-local accounts. |
| 276 base::FilePath component_policy_cache_root_; | 276 base::FilePath component_policy_cache_root_; |
| 277 | 277 |
| 278 base::WeakPtrFactory<DeviceLocalAccountPolicyService> weak_factory_; | 278 base::WeakPtrFactory<DeviceLocalAccountPolicyService> weak_factory_; |
| 279 | 279 |
| 280 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyService); | 280 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyService); |
| 281 }; | 281 }; |
| 282 | 282 |
| 283 } // namespace policy | 283 } // namespace policy |
| 284 | 284 |
| 285 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_SERVICE_H_ | 285 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_LOCAL_ACCOUNT_POLICY_SERVICE_H_ |
| OLD | NEW |