| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/configuration_policy_pref_store.h" | 5 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/profile.h" | 15 #include "chrome/browser/profile.h" |
| 16 #include "chrome/browser/policy/configuration_policy_provider.h" | 16 #include "chrome/browser/policy/configuration_policy_provider.h" |
| 17 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 18 #include "chrome/browser/policy/configuration_policy_provider_win.h" | 18 #include "chrome/browser/policy/configuration_policy_provider_win.h" |
| 19 #elif defined(OS_MACOSX) | 19 #elif defined(OS_MACOSX) |
| 20 #include "chrome/browser/policy/configuration_policy_provider_mac.h" | 20 #include "chrome/browser/policy/configuration_policy_provider_mac.h" |
| 21 #elif defined(OS_POSIX) | 21 #elif defined(OS_POSIX) |
| 22 #include "chrome/browser/policy/config_dir_policy_provider.h" | 22 #include "chrome/browser/policy/config_dir_policy_provider.h" |
| 23 #endif | 23 #endif |
| 24 #include "chrome/browser/policy/device_management_policy_provider.h" | 24 #include "chrome/browser/policy/device_management_policy_provider.h" |
| 25 #include "chrome/browser/policy/dummy_configuration_policy_provider.h" | 25 #include "chrome/browser/policy/dummy_configuration_policy_provider.h" |
| 26 #include "chrome/browser/policy/profile_policy_context.h" |
| 26 #include "chrome/browser/search_engines/search_terms_data.h" | 27 #include "chrome/browser/search_engines/search_terms_data.h" |
| 27 #include "chrome/browser/search_engines/template_url.h" | 28 #include "chrome/browser/search_engines/template_url.h" |
| 28 #include "chrome/common/chrome_paths.h" | 29 #include "chrome/common/chrome_paths.h" |
| 29 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
| 30 #include "chrome/common/policy_constants.h" | 31 #include "chrome/common/policy_constants.h" |
| 31 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
| 32 | 33 |
| 33 namespace policy { | 34 namespace policy { |
| 34 | 35 |
| 35 // Manages the lifecycle of the shared platform-specific policy providers for | 36 // Manages the lifecycle of the shared platform-specific policy providers for |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 } | 368 } |
| 368 | 369 |
| 369 // static | 370 // static |
| 370 ConfigurationPolicyPrefStore* | 371 ConfigurationPolicyPrefStore* |
| 371 ConfigurationPolicyPrefStore::CreateDeviceManagementPolicyPrefStore( | 372 ConfigurationPolicyPrefStore::CreateDeviceManagementPolicyPrefStore( |
| 372 Profile* profile) { | 373 Profile* profile) { |
| 373 ConfigurationPolicyProviderKeeper* keeper = | 374 ConfigurationPolicyProviderKeeper* keeper = |
| 374 Singleton<ConfigurationPolicyProviderKeeper>::get(); | 375 Singleton<ConfigurationPolicyProviderKeeper>::get(); |
| 375 ConfigurationPolicyProvider* provider = NULL; | 376 ConfigurationPolicyProvider* provider = NULL; |
| 376 if (profile) | 377 if (profile) |
| 377 provider = profile->GetDeviceManagementPolicyProvider(); | 378 provider = profile->GetPolicyContext()->GetDeviceManagementPolicyProvider(); |
| 378 if (!provider) | 379 if (!provider) |
| 379 provider = keeper->device_management_provider(); | 380 provider = keeper->device_management_provider(); |
| 380 return new ConfigurationPolicyPrefStore(provider); | 381 return new ConfigurationPolicyPrefStore(provider); |
| 381 } | 382 } |
| 382 | 383 |
| 383 // static | 384 // static |
| 384 ConfigurationPolicyPrefStore* | 385 ConfigurationPolicyPrefStore* |
| 385 ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore() { | 386 ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore() { |
| 386 ConfigurationPolicyProviderKeeper* keeper = | 387 ConfigurationPolicyProviderKeeper* keeper = |
| 387 Singleton<ConfigurationPolicyProviderKeeper>::get(); | 388 Singleton<ConfigurationPolicyProviderKeeper>::get(); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 std::string()); | 643 std::string()); |
| 643 return; | 644 return; |
| 644 } | 645 } |
| 645 } | 646 } |
| 646 // Required entries are not there. Remove any related entries. | 647 // Required entries are not there. Remove any related entries. |
| 647 RemovePreferencesOfMap(kDefaultSearchPolicyMap, | 648 RemovePreferencesOfMap(kDefaultSearchPolicyMap, |
| 648 arraysize(kDefaultSearchPolicyMap)); | 649 arraysize(kDefaultSearchPolicyMap)); |
| 649 } | 650 } |
| 650 | 651 |
| 651 } // namespace policy | 652 } // namespace policy |
| OLD | NEW |