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