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/configuration_policy_pref_store.h" | 5 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/stl_util-inl.h" | 15 #include "base/stl_util-inl.h" |
16 #include "base/string16.h" | 16 #include "base/string16.h" |
17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/policy/browser_policy_connector.h" | |
21 #include "chrome/browser/policy/configuration_policy_provider.h" | 22 #include "chrome/browser/policy/configuration_policy_provider.h" |
22 #include "chrome/browser/policy/configuration_policy_provider_keeper.h" | 23 #include "chrome/browser/policy/profile_policy_connector.h" |
23 #include "chrome/browser/policy/device_management_policy_provider.h" | |
24 #include "chrome/browser/policy/profile_policy_context.h" | |
25 #include "chrome/browser/prefs/pref_value_map.h" | 24 #include "chrome/browser/prefs/pref_value_map.h" |
26 #include "chrome/browser/prefs/proxy_config_dictionary.h" | 25 #include "chrome/browser/prefs/proxy_config_dictionary.h" |
27 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
28 #include "chrome/browser/search_engines/search_terms_data.h" | 27 #include "chrome/browser/search_engines/search_terms_data.h" |
29 #include "chrome/browser/search_engines/template_url.h" | 28 #include "chrome/browser/search_engines/template_url.h" |
30 #include "chrome/common/notification_service.h" | 29 #include "chrome/common/notification_service.h" |
31 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
32 #include "policy/policy_constants.h" | 31 #include "policy/policy_constants.h" |
33 | 32 |
34 namespace policy { | 33 namespace policy { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 prefs::kEnableAuthNegotiatePort }, | 218 prefs::kEnableAuthNegotiatePort }, |
220 { Value::TYPE_STRING, kPolicyAuthServerWhitelist, | 219 { Value::TYPE_STRING, kPolicyAuthServerWhitelist, |
221 prefs::kAuthServerWhitelist }, | 220 prefs::kAuthServerWhitelist }, |
222 { Value::TYPE_STRING, kPolicyAuthNegotiateDelegateWhitelist, | 221 { Value::TYPE_STRING, kPolicyAuthNegotiateDelegateWhitelist, |
223 prefs::kAuthNegotiateDelegateWhitelist }, | 222 prefs::kAuthNegotiateDelegateWhitelist }, |
224 { Value::TYPE_STRING, kPolicyGSSAPILibraryName, | 223 { Value::TYPE_STRING, kPolicyGSSAPILibraryName, |
225 prefs::kGSSAPILibraryName }, | 224 prefs::kGSSAPILibraryName }, |
226 { Value::TYPE_BOOLEAN, kPolicyDisable3DAPIs, | 225 { Value::TYPE_BOOLEAN, kPolicyDisable3DAPIs, |
227 prefs::kDisable3DAPIs }, | 226 prefs::kDisable3DAPIs }, |
228 { Value::TYPE_INTEGER, kPolicyPolicyRefreshRate, | 227 { Value::TYPE_INTEGER, kPolicyPolicyRefreshRate, |
229 prefs::kPolicyRefreshRate }, | 228 prefs::kPolicyUserPolicyRefreshRate }, |
230 { Value::TYPE_BOOLEAN, kPolicyInstantEnabled, prefs::kInstantEnabled }, | 229 { Value::TYPE_BOOLEAN, kPolicyInstantEnabled, prefs::kInstantEnabled }, |
231 { Value::TYPE_BOOLEAN, kPolicyDefaultBrowserSettingEnabled, | 230 { Value::TYPE_BOOLEAN, kPolicyDefaultBrowserSettingEnabled, |
232 prefs::kDefaultBrowserSettingEnabled }, | 231 prefs::kDefaultBrowserSettingEnabled }, |
233 { Value::TYPE_BOOLEAN, kPolicyCloudPrintProxyEnabled, | 232 { Value::TYPE_BOOLEAN, kPolicyCloudPrintProxyEnabled, |
234 prefs::kCloudPrintProxyEnabled }, | 233 prefs::kCloudPrintProxyEnabled }, |
235 | 234 |
236 #if defined(OS_CHROMEOS) | 235 #if defined(OS_CHROMEOS) |
237 { Value::TYPE_BOOLEAN, kPolicyChromeOsLockOnIdleSuspend, | 236 { Value::TYPE_BOOLEAN, kPolicyChromeOsLockOnIdleSuspend, |
238 prefs::kEnableScreenLock }, | 237 prefs::kEnableScreenLock }, |
239 #endif | 238 #endif |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
727 Refresh(); | 726 Refresh(); |
728 } | 727 } |
729 | 728 |
730 void ConfigurationPolicyPrefStore::OnProviderGoingAway() { | 729 void ConfigurationPolicyPrefStore::OnProviderGoingAway() { |
731 provider_ = NULL; | 730 provider_ = NULL; |
732 } | 731 } |
733 | 732 |
734 // static | 733 // static |
735 ConfigurationPolicyPrefStore* | 734 ConfigurationPolicyPrefStore* |
736 ConfigurationPolicyPrefStore::CreateManagedPlatformPolicyPrefStore() { | 735 ConfigurationPolicyPrefStore::CreateManagedPlatformPolicyPrefStore() { |
737 ConfigurationPolicyProviderKeeper* keeper = | 736 BrowserPolicyConnector* connector = |
738 g_browser_process->configuration_policy_provider_keeper(); | 737 g_browser_process->browser_policy_connector(); |
739 return new ConfigurationPolicyPrefStore(keeper->managed_platform_provider()); | 738 return new ConfigurationPolicyPrefStore( |
739 connector->GetManagedPlatformProvider()); | |
740 } | 740 } |
741 | 741 |
742 // static | 742 // static |
743 ConfigurationPolicyPrefStore* | 743 ConfigurationPolicyPrefStore* |
744 ConfigurationPolicyPrefStore::CreateManagedCloudPolicyPrefStore( | 744 ConfigurationPolicyPrefStore::CreateManagedCloudPolicyPrefStore( |
745 Profile* profile) { | 745 Profile* profile) { |
746 if (profile) { | 746 ConfigurationPolicyProvider* provider = NULL; |
747 return new ConfigurationPolicyPrefStore( | 747 if (profile) |
748 profile->GetPolicyContext()->GetDeviceManagementPolicyProvider()); | 748 provider = profile->GetPolicyConnector()->GetManagedPolicyProvider(); |
749 if (!provider) { | |
gfeher
2011/02/14 17:28:50
Is this logic a temporary thing that will go away
Mattias Nissler (ping if slow)
2011/02/15 10:15:16
The point here is that for user policy (i.e. profi
Jakob Kummerow
2011/02/21 12:12:15
Done. And I've thrown in a comment for good measur
| |
750 BrowserPolicyConnector* connector = | |
751 g_browser_process->browser_policy_connector(); | |
Mattias Nissler (ping if slow)
2011/02/15 10:15:16
do we need the connector local? I guess it doesn't
Jakob Kummerow
2011/02/21 12:12:15
We don't need it, but it prevents an ugly line bre
| |
752 provider = connector->GetManagedCloudProvider(); | |
749 } | 753 } |
750 return new ConfigurationPolicyPrefStore(NULL); | 754 return new ConfigurationPolicyPrefStore(provider); |
751 } | 755 } |
752 | 756 |
753 // static | 757 // static |
754 ConfigurationPolicyPrefStore* | 758 ConfigurationPolicyPrefStore* |
755 ConfigurationPolicyPrefStore::CreateRecommendedPlatformPolicyPrefStore() { | 759 ConfigurationPolicyPrefStore::CreateRecommendedPlatformPolicyPrefStore() { |
756 ConfigurationPolicyProviderKeeper* keeper = | 760 BrowserPolicyConnector* connector = |
757 g_browser_process->configuration_policy_provider_keeper(); | 761 g_browser_process->browser_policy_connector(); |
758 return new ConfigurationPolicyPrefStore(keeper->recommended_provider()); | 762 return new ConfigurationPolicyPrefStore( |
763 connector->GetRecommendedPlatformProvider()); | |
759 } | 764 } |
760 | 765 |
761 // static | 766 // static |
762 ConfigurationPolicyPrefStore* | 767 ConfigurationPolicyPrefStore* |
763 ConfigurationPolicyPrefStore::CreateRecommendedCloudPolicyPrefStore( | 768 ConfigurationPolicyPrefStore::CreateRecommendedCloudPolicyPrefStore( |
764 Profile* profile) { | 769 Profile* profile) { |
765 return new ConfigurationPolicyPrefStore(NULL); | 770 ConfigurationPolicyProvider* provider = NULL; |
771 if (profile) | |
772 provider = profile->GetPolicyConnector()->GetRecommendedPolicyProvider(); | |
773 if (!provider) { | |
Mattias Nissler (ping if slow)
2011/02/15 10:15:16
same here.
Jakob Kummerow
2011/02/21 12:12:15
Done.
| |
774 BrowserPolicyConnector* connector = | |
775 g_browser_process->browser_policy_connector(); | |
Mattias Nissler (ping if slow)
2011/02/15 10:15:16
drop connector local?
Jakob Kummerow
2011/02/21 12:12:15
Same as above -- keeping it as it is for line brea
| |
776 provider = connector->GetRecommendedCloudProvider(); | |
777 } | |
778 return new ConfigurationPolicyPrefStore(provider); | |
766 } | 779 } |
767 | 780 |
768 /* static */ | 781 /* static */ |
769 const ConfigurationPolicyProvider::PolicyDefinitionList* | 782 const ConfigurationPolicyProvider::PolicyDefinitionList* |
770 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList() { | 783 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList() { |
771 static ConfigurationPolicyProvider::PolicyDefinitionList::Entry entries[] = { | 784 static ConfigurationPolicyProvider::PolicyDefinitionList::Entry entries[] = { |
772 { kPolicyHomepageLocation, Value::TYPE_STRING, key::kHomepageLocation }, | 785 { kPolicyHomepageLocation, Value::TYPE_STRING, key::kHomepageLocation }, |
773 { kPolicyHomepageIsNewTabPage, Value::TYPE_BOOLEAN, | 786 { kPolicyHomepageIsNewTabPage, Value::TYPE_BOOLEAN, |
774 key::kHomepageIsNewTabPage }, | 787 key::kHomepageIsNewTabPage }, |
775 { kPolicyRestoreOnStartup, Value::TYPE_INTEGER, key::kRestoreOnStartup }, | 788 { kPolicyRestoreOnStartup, Value::TYPE_INTEGER, key::kRestoreOnStartup }, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
902 // Update the initialization flag. | 915 // Update the initialization flag. |
903 if (!initialization_complete_ && | 916 if (!initialization_complete_ && |
904 provider_->IsInitializationComplete()) { | 917 provider_->IsInitializationComplete()) { |
905 initialization_complete_ = true; | 918 initialization_complete_ = true; |
906 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, | 919 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, |
907 OnInitializationCompleted()); | 920 OnInitializationCompleted()); |
908 } | 921 } |
909 } | 922 } |
910 | 923 |
911 } // namespace policy | 924 } // namespace policy |
OLD | NEW |