OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/policy/browser_policy_connector.h" | 5 #include "chrome/browser/policy/browser_policy_connector.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "chrome/browser/net/gaia/token_service.h" | 9 #include "chrome/browser/net/gaia/token_service.h" |
10 #include "chrome/browser/policy/cloud_policy_data_store.h" | 10 #include "chrome/browser/policy/cloud_policy_data_store.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 device_cloud_policy_subsystem_.reset(); | 69 device_cloud_policy_subsystem_.reset(); |
70 device_data_store_.reset(); | 70 device_data_store_.reset(); |
71 #endif | 71 #endif |
72 | 72 |
73 // Shutdown user cloud policy. | 73 // Shutdown user cloud policy. |
74 if (user_cloud_policy_subsystem_.get()) | 74 if (user_cloud_policy_subsystem_.get()) |
75 user_cloud_policy_subsystem_->Shutdown(); | 75 user_cloud_policy_subsystem_->Shutdown(); |
76 user_cloud_policy_subsystem_.reset(); | 76 user_cloud_policy_subsystem_.reset(); |
77 user_policy_token_cache_.reset(); | 77 user_policy_token_cache_.reset(); |
78 user_data_store_.reset(); | 78 user_data_store_.reset(); |
| 79 |
| 80 DeleteConfigurationPolicyHandlers(&policy_handlers_); |
79 } | 81 } |
80 | 82 |
81 ConfigurationPolicyProvider* | 83 ConfigurationPolicyProvider* |
82 BrowserPolicyConnector::GetManagedPlatformProvider() const { | 84 BrowserPolicyConnector::GetManagedPlatformProvider() const { |
83 return managed_platform_provider_.get(); | 85 return managed_platform_provider_.get(); |
84 } | 86 } |
85 | 87 |
86 ConfigurationPolicyProvider* | 88 ConfigurationPolicyProvider* |
87 BrowserPolicyConnector::GetManagedCloudProvider() const { | 89 BrowserPolicyConnector::GetManagedCloudProvider() const { |
88 return managed_cloud_provider_.get(); | 90 return managed_cloud_provider_.get(); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 #else | 260 #else |
259 return NULL; | 261 return NULL; |
260 #endif | 262 #endif |
261 } | 263 } |
262 | 264 |
263 const CloudPolicyDataStore* | 265 const CloudPolicyDataStore* |
264 BrowserPolicyConnector::GetUserCloudPolicyDataStore() const { | 266 BrowserPolicyConnector::GetUserCloudPolicyDataStore() const { |
265 return user_data_store_.get(); | 267 return user_data_store_.get(); |
266 } | 268 } |
267 | 269 |
| 270 const HandlerList* |
| 271 BrowserPolicyConnector::GetConfigurationPolicyHandlerList() const { |
| 272 return &policy_handlers_; |
| 273 } |
| 274 |
268 BrowserPolicyConnector::BrowserPolicyConnector() | 275 BrowserPolicyConnector::BrowserPolicyConnector() |
269 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { | 276 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { |
270 managed_platform_provider_.reset(CreateManagedPlatformProvider()); | 277 managed_platform_provider_.reset(CreateManagedPlatformProvider()); |
271 recommended_platform_provider_.reset(CreateRecommendedPlatformProvider()); | 278 recommended_platform_provider_.reset(CreateRecommendedPlatformProvider()); |
272 | 279 |
273 managed_cloud_provider_.reset(new CloudPolicyProviderImpl( | 280 managed_cloud_provider_.reset(new CloudPolicyProviderImpl( |
274 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), | 281 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), |
275 CloudPolicyCacheBase::POLICY_LEVEL_MANDATORY)); | 282 CloudPolicyCacheBase::POLICY_LEVEL_MANDATORY)); |
276 recommended_cloud_provider_.reset(new CloudPolicyProviderImpl( | 283 recommended_cloud_provider_.reset(new CloudPolicyProviderImpl( |
277 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), | 284 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), |
278 CloudPolicyCacheBase::POLICY_LEVEL_RECOMMENDED)); | 285 CloudPolicyCacheBase::POLICY_LEVEL_RECOMMENDED)); |
279 | 286 |
280 #if defined(OS_CHROMEOS) | 287 #if defined(OS_CHROMEOS) |
281 InitializeDevicePolicy(); | 288 InitializeDevicePolicy(); |
282 #endif | 289 #endif |
| 290 MakeConfigurationPolicyHandlers(&policy_handlers_); |
283 } | 291 } |
284 | 292 |
285 BrowserPolicyConnector::BrowserPolicyConnector( | 293 BrowserPolicyConnector::BrowserPolicyConnector( |
286 ConfigurationPolicyProvider* managed_platform_provider, | 294 ConfigurationPolicyProvider* managed_platform_provider, |
287 ConfigurationPolicyProvider* recommended_platform_provider, | 295 ConfigurationPolicyProvider* recommended_platform_provider, |
288 CloudPolicyProvider* managed_cloud_provider, | 296 CloudPolicyProvider* managed_cloud_provider, |
289 CloudPolicyProvider* recommended_cloud_provider) | 297 CloudPolicyProvider* recommended_cloud_provider) |
290 : managed_platform_provider_(managed_platform_provider), | 298 : managed_platform_provider_(managed_platform_provider), |
291 recommended_platform_provider_(recommended_platform_provider), | 299 recommended_platform_provider_(recommended_platform_provider), |
292 managed_cloud_provider_(managed_cloud_provider), | 300 managed_cloud_provider_(managed_cloud_provider), |
293 recommended_cloud_provider_(recommended_cloud_provider), | 301 recommended_cloud_provider_(recommended_cloud_provider), |
294 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {} | 302 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { |
| 303 MakeConfigurationPolicyHandlers(&policy_handlers_); |
| 304 } |
295 | 305 |
296 void BrowserPolicyConnector::Observe(int type, | 306 void BrowserPolicyConnector::Observe(int type, |
297 const NotificationSource& source, | 307 const NotificationSource& source, |
298 const NotificationDetails& details) { | 308 const NotificationDetails& details) { |
299 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 309 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
300 if (type == chrome::NOTIFICATION_TOKEN_AVAILABLE) { | 310 if (type == chrome::NOTIFICATION_TOKEN_AVAILABLE) { |
301 const TokenService* token_source = | 311 const TokenService* token_source = |
302 Source<const TokenService>(source).ptr(); | 312 Source<const TokenService>(source).ptr(); |
303 DCHECK_EQ(token_service_, token_source); | 313 DCHECK_EQ(token_service_, token_source); |
304 const TokenService::TokenAvailableDetails* token_details = | 314 const TokenService::TokenAvailableDetails* token_details = |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 config_dir_path.Append(FILE_PATH_LITERAL("recommended"))); | 429 config_dir_path.Append(FILE_PATH_LITERAL("recommended"))); |
420 } else { | 430 } else { |
421 return new DummyConfigurationPolicyProvider(policy_list); | 431 return new DummyConfigurationPolicyProvider(policy_list); |
422 } | 432 } |
423 #else | 433 #else |
424 return new DummyConfigurationPolicyProvider(policy_list); | 434 return new DummyConfigurationPolicyProvider(policy_list); |
425 #endif | 435 #endif |
426 } | 436 } |
427 | 437 |
428 } // namespace | 438 } // namespace |
OLD | NEW |