| 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 new DeviceStatusCollector(g_browser_process->local_state())); | 444 new DeviceStatusCollector(g_browser_process->local_state())); |
| 445 #endif | 445 #endif |
| 446 } | 446 } |
| 447 | 447 |
| 448 // static | 448 // static |
| 449 ConfigurationPolicyProvider* | 449 ConfigurationPolicyProvider* |
| 450 BrowserPolicyConnector::CreateManagedPlatformProvider() { | 450 BrowserPolicyConnector::CreateManagedPlatformProvider() { |
| 451 const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList(); | 451 const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList(); |
| 452 #if defined(OS_WIN) | 452 #if defined(OS_WIN) |
| 453 return new ConfigurationPolicyProviderWin(policy_list, | 453 return new ConfigurationPolicyProviderWin(policy_list, |
| 454 policy::kRegistryMandatorySubKey); | 454 policy::kRegistryMandatorySubKey, |
| 455 POLICY_LEVEL_MANDATORY); |
| 455 #elif defined(OS_MACOSX) | 456 #elif defined(OS_MACOSX) |
| 456 return new ConfigurationPolicyProviderMac(policy_list); | 457 return new ConfigurationPolicyProviderMac(policy_list, |
| 458 POLICY_LEVEL_MANDATORY); |
| 457 #elif defined(OS_POSIX) | 459 #elif defined(OS_POSIX) |
| 458 FilePath config_dir_path; | 460 FilePath config_dir_path; |
| 459 if (PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) { | 461 if (PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) { |
| 460 return new ConfigDirPolicyProvider( | 462 return new ConfigDirPolicyProvider( |
| 461 policy_list, | 463 policy_list, |
| 464 POLICY_LEVEL_MANDATORY, |
| 462 config_dir_path.Append(FILE_PATH_LITERAL("managed"))); | 465 config_dir_path.Append(FILE_PATH_LITERAL("managed"))); |
| 463 } else { | 466 } else { |
| 464 return NULL; | 467 return NULL; |
| 465 } | 468 } |
| 466 #else | 469 #else |
| 467 return NULL; | 470 return NULL; |
| 468 #endif | 471 #endif |
| 469 } | 472 } |
| 470 | 473 |
| 471 // static | 474 // static |
| 472 ConfigurationPolicyProvider* | 475 ConfigurationPolicyProvider* |
| 473 BrowserPolicyConnector::CreateRecommendedPlatformProvider() { | 476 BrowserPolicyConnector::CreateRecommendedPlatformProvider() { |
| 474 #if defined(OS_WIN) | 477 #if defined(OS_WIN) |
| 475 const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList(); | 478 const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList(); |
| 476 return new ConfigurationPolicyProviderWin(policy_list, | 479 return new ConfigurationPolicyProviderWin(policy_list, |
| 477 policy::kRegistryRecommendedSubKey); | 480 policy::kRegistryRecommendedSubKey, |
| 481 POLICY_LEVEL_RECOMMENDED); |
| 478 #elif defined(OS_POSIX) && !defined(OS_MACOSX) | 482 #elif defined(OS_POSIX) && !defined(OS_MACOSX) |
| 479 const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList(); | 483 const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList(); |
| 480 FilePath config_dir_path; | 484 FilePath config_dir_path; |
| 481 if (PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) { | 485 if (PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) { |
| 482 return new ConfigDirPolicyProvider( | 486 return new ConfigDirPolicyProvider( |
| 483 policy_list, | 487 policy_list, |
| 488 POLICY_LEVEL_RECOMMENDED, |
| 484 config_dir_path.Append(FILE_PATH_LITERAL("recommended"))); | 489 config_dir_path.Append(FILE_PATH_LITERAL("recommended"))); |
| 485 } else { | 490 } else { |
| 486 return NULL; | 491 return NULL; |
| 487 } | 492 } |
| 488 #else | 493 #else |
| 489 return NULL; | 494 return NULL; |
| 490 #endif | 495 #endif |
| 491 } | 496 } |
| 492 | 497 |
| 493 } // namespace policy | 498 } // namespace policy |
| OLD | NEW |