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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 #else | 258 #else |
259 return NULL; | 259 return NULL; |
260 #endif | 260 #endif |
261 } | 261 } |
262 | 262 |
263 const CloudPolicyDataStore* | 263 const CloudPolicyDataStore* |
264 BrowserPolicyConnector::GetUserCloudPolicyDataStore() const { | 264 BrowserPolicyConnector::GetUserCloudPolicyDataStore() const { |
265 return user_data_store_.get(); | 265 return user_data_store_.get(); |
266 } | 266 } |
267 | 267 |
| 268 const ConfigurationPolicyHandlerFactory::HandlerList* |
| 269 BrowserPolicyConnector::GetConfigurationPolicyHandlerList() const { |
| 270 return policy_handlers_.get(); |
| 271 } |
| 272 |
268 BrowserPolicyConnector::BrowserPolicyConnector() | 273 BrowserPolicyConnector::BrowserPolicyConnector() |
269 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { | 274 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { |
270 managed_platform_provider_.reset(CreateManagedPlatformProvider()); | 275 managed_platform_provider_.reset(CreateManagedPlatformProvider()); |
271 recommended_platform_provider_.reset(CreateRecommendedPlatformProvider()); | 276 recommended_platform_provider_.reset(CreateRecommendedPlatformProvider()); |
272 | 277 |
273 managed_cloud_provider_.reset(new CloudPolicyProviderImpl( | 278 managed_cloud_provider_.reset(new CloudPolicyProviderImpl( |
274 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), | 279 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), |
275 CloudPolicyCacheBase::POLICY_LEVEL_MANDATORY)); | 280 CloudPolicyCacheBase::POLICY_LEVEL_MANDATORY)); |
276 recommended_cloud_provider_.reset(new CloudPolicyProviderImpl( | 281 recommended_cloud_provider_.reset(new CloudPolicyProviderImpl( |
277 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), | 282 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), |
278 CloudPolicyCacheBase::POLICY_LEVEL_RECOMMENDED)); | 283 CloudPolicyCacheBase::POLICY_LEVEL_RECOMMENDED)); |
279 | 284 |
280 #if defined(OS_CHROMEOS) | 285 #if defined(OS_CHROMEOS) |
281 InitializeDevicePolicy(); | 286 InitializeDevicePolicy(); |
282 #endif | 287 #endif |
| 288 policy_handlers_.reset(ConfigurationPolicyHandlerFactory::MakeHandlers()); |
283 } | 289 } |
284 | 290 |
285 BrowserPolicyConnector::BrowserPolicyConnector( | 291 BrowserPolicyConnector::BrowserPolicyConnector( |
286 ConfigurationPolicyProvider* managed_platform_provider, | 292 ConfigurationPolicyProvider* managed_platform_provider, |
287 ConfigurationPolicyProvider* recommended_platform_provider, | 293 ConfigurationPolicyProvider* recommended_platform_provider, |
288 CloudPolicyProvider* managed_cloud_provider, | 294 CloudPolicyProvider* managed_cloud_provider, |
289 CloudPolicyProvider* recommended_cloud_provider) | 295 CloudPolicyProvider* recommended_cloud_provider) |
290 : managed_platform_provider_(managed_platform_provider), | 296 : managed_platform_provider_(managed_platform_provider), |
291 recommended_platform_provider_(recommended_platform_provider), | 297 recommended_platform_provider_(recommended_platform_provider), |
292 managed_cloud_provider_(managed_cloud_provider), | 298 managed_cloud_provider_(managed_cloud_provider), |
293 recommended_cloud_provider_(recommended_cloud_provider), | 299 recommended_cloud_provider_(recommended_cloud_provider), |
294 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {} | 300 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { |
| 301 policy_handlers_.reset(ConfigurationPolicyHandlerFactory::MakeHandlers()); |
| 302 } |
295 | 303 |
296 void BrowserPolicyConnector::Observe(int type, | 304 void BrowserPolicyConnector::Observe(int type, |
297 const NotificationSource& source, | 305 const NotificationSource& source, |
298 const NotificationDetails& details) { | 306 const NotificationDetails& details) { |
299 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 307 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
300 if (type == chrome::NOTIFICATION_TOKEN_AVAILABLE) { | 308 if (type == chrome::NOTIFICATION_TOKEN_AVAILABLE) { |
301 const TokenService* token_source = | 309 const TokenService* token_source = |
302 Source<const TokenService>(source).ptr(); | 310 Source<const TokenService>(source).ptr(); |
303 DCHECK_EQ(token_service_, token_source); | 311 DCHECK_EQ(token_service_, token_source); |
304 const TokenService::TokenAvailableDetails* token_details = | 312 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"))); | 427 config_dir_path.Append(FILE_PATH_LITERAL("recommended"))); |
420 } else { | 428 } else { |
421 return new DummyConfigurationPolicyProvider(policy_list); | 429 return new DummyConfigurationPolicyProvider(policy_list); |
422 } | 430 } |
423 #else | 431 #else |
424 return new DummyConfigurationPolicyProvider(policy_list); | 432 return new DummyConfigurationPolicyProvider(policy_list); |
425 #endif | 433 #endif |
426 } | 434 } |
427 | 435 |
428 } // namespace | 436 } // namespace |
OLD | NEW |