| 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 #include "chrome/browser/policy/browser_policy_connector.h" | 5 #include "chrome/browser/policy/browser_policy_connector.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 user_data_store_.reset(); | 101 user_data_store_.reset(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void BrowserPolicyConnector::Init() { | 104 void BrowserPolicyConnector::Init() { |
| 105 managed_platform_provider_.reset(CreateManagedPlatformProvider()); | 105 managed_platform_provider_.reset(CreateManagedPlatformProvider()); |
| 106 recommended_platform_provider_.reset(CreateRecommendedPlatformProvider()); | 106 recommended_platform_provider_.reset(CreateRecommendedPlatformProvider()); |
| 107 | 107 |
| 108 managed_cloud_provider_.reset(new CloudPolicyProviderImpl( | 108 managed_cloud_provider_.reset(new CloudPolicyProviderImpl( |
| 109 this, | 109 this, |
| 110 GetChromePolicyDefinitionList(), | 110 GetChromePolicyDefinitionList(), |
| 111 CloudPolicyCacheBase::POLICY_LEVEL_MANDATORY)); | 111 POLICY_LEVEL_MANDATORY)); |
| 112 recommended_cloud_provider_.reset(new CloudPolicyProviderImpl( | 112 recommended_cloud_provider_.reset(new CloudPolicyProviderImpl( |
| 113 this, | 113 this, |
| 114 GetChromePolicyDefinitionList(), | 114 GetChromePolicyDefinitionList(), |
| 115 CloudPolicyCacheBase::POLICY_LEVEL_RECOMMENDED)); | 115 POLICY_LEVEL_RECOMMENDED)); |
| 116 | 116 |
| 117 #if defined(OS_CHROMEOS) | 117 #if defined(OS_CHROMEOS) |
| 118 InitializeDevicePolicy(); | 118 InitializeDevicePolicy(); |
| 119 | 119 |
| 120 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableONCPolicy)) { | 120 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableONCPolicy)) { |
| 121 network_configuration_updater_.reset( | 121 network_configuration_updater_.reset( |
| 122 new NetworkConfigurationUpdater( | 122 new NetworkConfigurationUpdater( |
| 123 managed_cloud_provider_.get(), | 123 managed_cloud_provider_.get(), |
| 124 chromeos::CrosLibrary::Get()->GetNetworkLibrary())); | 124 chromeos::CrosLibrary::Get()->GetNetworkLibrary())); |
| 125 } | 125 } |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 chromeos::system::StatisticsProvider::GetInstance())); | 446 chromeos::system::StatisticsProvider::GetInstance())); |
| 447 #endif | 447 #endif |
| 448 } | 448 } |
| 449 | 449 |
| 450 // static | 450 // static |
| 451 ConfigurationPolicyProvider* | 451 ConfigurationPolicyProvider* |
| 452 BrowserPolicyConnector::CreateManagedPlatformProvider() { | 452 BrowserPolicyConnector::CreateManagedPlatformProvider() { |
| 453 const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList(); | 453 const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList(); |
| 454 #if defined(OS_WIN) | 454 #if defined(OS_WIN) |
| 455 return new ConfigurationPolicyProviderWin(policy_list, | 455 return new ConfigurationPolicyProviderWin(policy_list, |
| 456 policy::kRegistryMandatorySubKey); | 456 policy::kRegistryMandatorySubKey, |
| 457 POLICY_LEVEL_MANDATORY); |
| 457 #elif defined(OS_MACOSX) | 458 #elif defined(OS_MACOSX) |
| 458 return new ConfigurationPolicyProviderMac(policy_list); | 459 return new ConfigurationPolicyProviderMac(policy_list, |
| 460 POLICY_LEVEL_MANDATORY); |
| 459 #elif defined(OS_POSIX) | 461 #elif defined(OS_POSIX) |
| 460 FilePath config_dir_path; | 462 FilePath config_dir_path; |
| 461 if (PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) { | 463 if (PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) { |
| 462 return new ConfigDirPolicyProvider( | 464 return new ConfigDirPolicyProvider( |
| 463 policy_list, | 465 policy_list, |
| 466 POLICY_LEVEL_MANDATORY, |
| 464 config_dir_path.Append(FILE_PATH_LITERAL("managed"))); | 467 config_dir_path.Append(FILE_PATH_LITERAL("managed"))); |
| 465 } else { | 468 } else { |
| 466 return NULL; | 469 return NULL; |
| 467 } | 470 } |
| 468 #else | 471 #else |
| 469 return NULL; | 472 return NULL; |
| 470 #endif | 473 #endif |
| 471 } | 474 } |
| 472 | 475 |
| 473 // static | 476 // static |
| 474 ConfigurationPolicyProvider* | 477 ConfigurationPolicyProvider* |
| 475 BrowserPolicyConnector::CreateRecommendedPlatformProvider() { | 478 BrowserPolicyConnector::CreateRecommendedPlatformProvider() { |
| 476 #if defined(OS_WIN) | 479 #if defined(OS_WIN) |
| 477 const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList(); | 480 const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList(); |
| 478 return new ConfigurationPolicyProviderWin(policy_list, | 481 return new ConfigurationPolicyProviderWin(policy_list, |
| 479 policy::kRegistryRecommendedSubKey); | 482 policy::kRegistryRecommendedSubKey, |
| 483 POLICY_LEVEL_RECOMMENDED); |
| 480 #elif defined(OS_POSIX) && !defined(OS_MACOSX) | 484 #elif defined(OS_POSIX) && !defined(OS_MACOSX) |
| 481 const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList(); | 485 const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList(); |
| 482 FilePath config_dir_path; | 486 FilePath config_dir_path; |
| 483 if (PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) { | 487 if (PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) { |
| 484 return new ConfigDirPolicyProvider( | 488 return new ConfigDirPolicyProvider( |
| 485 policy_list, | 489 policy_list, |
| 490 POLICY_LEVEL_RECOMMENDED, |
| 486 config_dir_path.Append(FILE_PATH_LITERAL("recommended"))); | 491 config_dir_path.Append(FILE_PATH_LITERAL("recommended"))); |
| 487 } else { | 492 } else { |
| 488 return NULL; | 493 return NULL; |
| 489 } | 494 } |
| 490 #else | 495 #else |
| 491 return NULL; | 496 return NULL; |
| 492 #endif | 497 #endif |
| 493 } | 498 } |
| 494 | 499 |
| 495 } // namespace policy | 500 } // namespace policy |
| OLD | NEW |