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> |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/policy/configuration_policy_provider.h" | 21 #include "chrome/browser/policy/configuration_policy_provider.h" |
22 #include "chrome/browser/policy/configuration_policy_provider_keeper.h" | 22 #include "chrome/browser/policy/configuration_policy_provider_keeper.h" |
23 #include "chrome/browser/policy/device_management_policy_provider.h" | 23 #include "chrome/browser/policy/device_management_policy_provider.h" |
24 #include "chrome/browser/policy/profile_policy_context.h" | 24 #include "chrome/browser/policy/profile_policy_context.h" |
25 #include "chrome/browser/prefs/pref_value_map.h" | 25 #include "chrome/browser/prefs/pref_value_map.h" |
26 #include "chrome/browser/prefs/proxy_prefs.h" | 26 #include "chrome/browser/prefs/proxy_prefs.h" |
27 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
28 #include "chrome/browser/search_engines/search_terms_data.h" | 28 #include "chrome/browser/search_engines/search_terms_data.h" |
29 #include "chrome/browser/search_engines/template_url.h" | 29 #include "chrome/browser/search_engines/template_url.h" |
30 #include "chrome/common/notification_service.h" | 30 #include "chrome/common/notification_service.h" |
31 #include "chrome/common/policy_constants.h" | |
32 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| 32 #include "policy/policy_constants.h" |
33 | 33 |
34 namespace policy { | 34 namespace policy { |
35 | 35 |
36 // Accepts policy settings from a ConfigurationPolicyProvider, converts them | 36 // Accepts policy settings from a ConfigurationPolicyProvider, converts them |
37 // to preferences and caches the result. | 37 // to preferences and caches the result. |
38 class ConfigurationPolicyPrefKeeper | 38 class ConfigurationPolicyPrefKeeper |
39 : private ConfigurationPolicyStoreInterface { | 39 : private ConfigurationPolicyStoreInterface { |
40 public: | 40 public: |
41 explicit ConfigurationPolicyPrefKeeper(ConfigurationPolicyProvider* provider); | 41 explicit ConfigurationPolicyPrefKeeper(ConfigurationPolicyProvider* provider); |
42 virtual ~ConfigurationPolicyPrefKeeper(); | 42 virtual ~ConfigurationPolicyPrefKeeper(); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 static const PolicyToPreferenceMapEntry kSimplePolicyMap[]; | 144 static const PolicyToPreferenceMapEntry kSimplePolicyMap[]; |
145 static const PolicyToPreferenceMapEntry kProxyPolicyMap[]; | 145 static const PolicyToPreferenceMapEntry kProxyPolicyMap[]; |
146 static const PolicyToPreferenceMapEntry kDefaultSearchPolicyMap[]; | 146 static const PolicyToPreferenceMapEntry kDefaultSearchPolicyMap[]; |
147 | 147 |
148 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyPrefKeeper); | 148 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyPrefKeeper); |
149 }; | 149 }; |
150 | 150 |
151 const ConfigurationPolicyPrefKeeper::PolicyToPreferenceMapEntry | 151 const ConfigurationPolicyPrefKeeper::PolicyToPreferenceMapEntry |
152 ConfigurationPolicyPrefKeeper::kSimplePolicyMap[] = { | 152 ConfigurationPolicyPrefKeeper::kSimplePolicyMap[] = { |
153 { Value::TYPE_STRING, kPolicyHomePage, prefs::kHomePage }, | 153 { Value::TYPE_STRING, kPolicyHomepageLocation, prefs::kHomePage }, |
154 { Value::TYPE_BOOLEAN, kPolicyHomepageIsNewTabPage, | 154 { Value::TYPE_BOOLEAN, kPolicyHomepageIsNewTabPage, |
155 prefs::kHomePageIsNewTabPage }, | 155 prefs::kHomePageIsNewTabPage }, |
156 { Value::TYPE_INTEGER, kPolicyRestoreOnStartup, | 156 { Value::TYPE_INTEGER, kPolicyRestoreOnStartup, |
157 prefs::kRestoreOnStartup}, | 157 prefs::kRestoreOnStartup}, |
158 { Value::TYPE_LIST, kPolicyURLsToRestoreOnStartup, | 158 { Value::TYPE_LIST, kPolicyRestoreOnStartupURLs, |
159 prefs::kURLsToRestoreOnStartup }, | 159 prefs::kURLsToRestoreOnStartup }, |
160 { Value::TYPE_BOOLEAN, kPolicyAlternateErrorPagesEnabled, | 160 { Value::TYPE_BOOLEAN, kPolicyAlternateErrorPagesEnabled, |
161 prefs::kAlternateErrorPagesEnabled }, | 161 prefs::kAlternateErrorPagesEnabled }, |
162 { Value::TYPE_BOOLEAN, kPolicySearchSuggestEnabled, | 162 { Value::TYPE_BOOLEAN, kPolicySearchSuggestEnabled, |
163 prefs::kSearchSuggestEnabled }, | 163 prefs::kSearchSuggestEnabled }, |
164 { Value::TYPE_BOOLEAN, kPolicyDnsPrefetchingEnabled, | 164 { Value::TYPE_BOOLEAN, kPolicyDnsPrefetchingEnabled, |
165 prefs::kDnsPrefetchingEnabled }, | 165 prefs::kDnsPrefetchingEnabled }, |
166 { Value::TYPE_BOOLEAN, kPolicyDisableSpdy, | 166 { Value::TYPE_BOOLEAN, kPolicyDisableSpdy, |
167 prefs::kDisableSpdy }, | 167 prefs::kDisableSpdy }, |
168 { Value::TYPE_BOOLEAN, kPolicySafeBrowsingEnabled, | 168 { Value::TYPE_BOOLEAN, kPolicySafeBrowsingEnabled, |
169 prefs::kSafeBrowsingEnabled }, | 169 prefs::kSafeBrowsingEnabled }, |
170 { Value::TYPE_BOOLEAN, kPolicyPasswordManagerEnabled, | 170 { Value::TYPE_BOOLEAN, kPolicyPasswordManagerEnabled, |
171 prefs::kPasswordManagerEnabled }, | 171 prefs::kPasswordManagerEnabled }, |
172 { Value::TYPE_BOOLEAN, kPolicyPasswordManagerAllowShowPasswords, | 172 { Value::TYPE_BOOLEAN, kPolicyPasswordManagerAllowShowPasswords, |
173 prefs::kPasswordManagerAllowShowPasswords }, | 173 prefs::kPasswordManagerAllowShowPasswords }, |
174 { Value::TYPE_BOOLEAN, kPolicyPrintingEnabled, | 174 { Value::TYPE_BOOLEAN, kPolicyPrintingEnabled, |
175 prefs::kPrintingEnabled }, | 175 prefs::kPrintingEnabled }, |
176 { Value::TYPE_BOOLEAN, kPolicyMetricsReportingEnabled, | 176 { Value::TYPE_BOOLEAN, kPolicyMetricsReportingEnabled, |
177 prefs::kMetricsReportingEnabled }, | 177 prefs::kMetricsReportingEnabled }, |
178 { Value::TYPE_STRING, kPolicyApplicationLocale, | 178 { Value::TYPE_STRING, kPolicyApplicationLocaleValue, |
179 prefs::kApplicationLocale}, | 179 prefs::kApplicationLocale}, |
180 { Value::TYPE_LIST, kPolicyExtensionInstallAllowList, | 180 { Value::TYPE_LIST, kPolicyExtensionInstallWhitelist, |
181 prefs::kExtensionInstallAllowList}, | 181 prefs::kExtensionInstallAllowList}, |
182 { Value::TYPE_LIST, kPolicyExtensionInstallDenyList, | 182 { Value::TYPE_LIST, kPolicyExtensionInstallBlacklist, |
183 prefs::kExtensionInstallDenyList}, | 183 prefs::kExtensionInstallDenyList}, |
184 { Value::TYPE_LIST, kPolicyExtensionInstallForceList, | 184 { Value::TYPE_LIST, kPolicyExtensionInstallForcelist, |
185 prefs::kExtensionInstallForceList}, | 185 prefs::kExtensionInstallForceList}, |
186 { Value::TYPE_LIST, kPolicyDisabledPlugins, | 186 { Value::TYPE_LIST, kPolicyDisabledPlugins, |
187 prefs::kPluginsPluginsBlacklist}, | 187 prefs::kPluginsPluginsBlacklist}, |
188 { Value::TYPE_BOOLEAN, kPolicyShowHomeButton, | 188 { Value::TYPE_BOOLEAN, kPolicyShowHomeButton, |
189 prefs::kShowHomeButton }, | 189 prefs::kShowHomeButton }, |
190 { Value::TYPE_BOOLEAN, kPolicyJavascriptEnabled, | 190 { Value::TYPE_BOOLEAN, kPolicyJavascriptEnabled, |
191 prefs::kWebKitJavascriptEnabled }, | 191 prefs::kWebKitJavascriptEnabled }, |
192 { Value::TYPE_BOOLEAN, kPolicySavingBrowserHistoryDisabled, | 192 { Value::TYPE_BOOLEAN, kPolicySavingBrowserHistoryDisabled, |
193 prefs::kSavingBrowserHistoryDisabled }, | 193 prefs::kSavingBrowserHistoryDisabled }, |
194 { Value::TYPE_BOOLEAN, kPolicyDeveloperToolsDisabled, | 194 { Value::TYPE_BOOLEAN, kPolicyDeveloperToolsDisabled, |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore() { | 740 ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore() { |
741 ConfigurationPolicyProviderKeeper* keeper = | 741 ConfigurationPolicyProviderKeeper* keeper = |
742 g_browser_process->configuration_policy_provider_keeper(); | 742 g_browser_process->configuration_policy_provider_keeper(); |
743 return new ConfigurationPolicyPrefStore(keeper->recommended_provider()); | 743 return new ConfigurationPolicyPrefStore(keeper->recommended_provider()); |
744 } | 744 } |
745 | 745 |
746 /* static */ | 746 /* static */ |
747 const ConfigurationPolicyProvider::PolicyDefinitionList* | 747 const ConfigurationPolicyProvider::PolicyDefinitionList* |
748 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList() { | 748 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList() { |
749 static ConfigurationPolicyProvider::PolicyDefinitionList::Entry entries[] = { | 749 static ConfigurationPolicyProvider::PolicyDefinitionList::Entry entries[] = { |
750 { kPolicyHomePage, Value::TYPE_STRING, key::kHomepageLocation }, | 750 { kPolicyHomepageLocation, Value::TYPE_STRING, key::kHomepageLocation }, |
751 { kPolicyHomepageIsNewTabPage, Value::TYPE_BOOLEAN, | 751 { kPolicyHomepageIsNewTabPage, Value::TYPE_BOOLEAN, |
752 key::kHomepageIsNewTabPage }, | 752 key::kHomepageIsNewTabPage }, |
753 { kPolicyRestoreOnStartup, Value::TYPE_INTEGER, key::kRestoreOnStartup }, | 753 { kPolicyRestoreOnStartup, Value::TYPE_INTEGER, key::kRestoreOnStartup }, |
754 { kPolicyURLsToRestoreOnStartup, Value::TYPE_LIST, | 754 { kPolicyRestoreOnStartupURLs, Value::TYPE_LIST, |
755 key::kURLsToRestoreOnStartup }, | 755 key::kRestoreOnStartupURLs }, |
756 { kPolicyDefaultSearchProviderEnabled, Value::TYPE_BOOLEAN, | 756 { kPolicyDefaultSearchProviderEnabled, Value::TYPE_BOOLEAN, |
757 key::kDefaultSearchProviderEnabled }, | 757 key::kDefaultSearchProviderEnabled }, |
758 { kPolicyDefaultSearchProviderName, Value::TYPE_STRING, | 758 { kPolicyDefaultSearchProviderName, Value::TYPE_STRING, |
759 key::kDefaultSearchProviderName }, | 759 key::kDefaultSearchProviderName }, |
760 { kPolicyDefaultSearchProviderKeyword, Value::TYPE_STRING, | 760 { kPolicyDefaultSearchProviderKeyword, Value::TYPE_STRING, |
761 key::kDefaultSearchProviderKeyword }, | 761 key::kDefaultSearchProviderKeyword }, |
762 { kPolicyDefaultSearchProviderSearchURL, Value::TYPE_STRING, | 762 { kPolicyDefaultSearchProviderSearchURL, Value::TYPE_STRING, |
763 key::kDefaultSearchProviderSearchURL }, | 763 key::kDefaultSearchProviderSearchURL }, |
764 { kPolicyDefaultSearchProviderSuggestURL, Value::TYPE_STRING, | 764 { kPolicyDefaultSearchProviderSuggestURL, Value::TYPE_STRING, |
765 key::kDefaultSearchProviderSuggestURL }, | 765 key::kDefaultSearchProviderSuggestURL }, |
(...skipping 18 matching lines...) Expand all Loading... |
784 { kPolicySafeBrowsingEnabled, Value::TYPE_BOOLEAN, | 784 { kPolicySafeBrowsingEnabled, Value::TYPE_BOOLEAN, |
785 key::kSafeBrowsingEnabled }, | 785 key::kSafeBrowsingEnabled }, |
786 { kPolicyMetricsReportingEnabled, Value::TYPE_BOOLEAN, | 786 { kPolicyMetricsReportingEnabled, Value::TYPE_BOOLEAN, |
787 key::kMetricsReportingEnabled }, | 787 key::kMetricsReportingEnabled }, |
788 { kPolicyPasswordManagerEnabled, Value::TYPE_BOOLEAN, | 788 { kPolicyPasswordManagerEnabled, Value::TYPE_BOOLEAN, |
789 key::kPasswordManagerEnabled }, | 789 key::kPasswordManagerEnabled }, |
790 { kPolicyPasswordManagerAllowShowPasswords, Value::TYPE_BOOLEAN, | 790 { kPolicyPasswordManagerAllowShowPasswords, Value::TYPE_BOOLEAN, |
791 key::kPasswordManagerAllowShowPasswords }, | 791 key::kPasswordManagerAllowShowPasswords }, |
792 { kPolicyAutoFillEnabled, Value::TYPE_BOOLEAN, key::kAutoFillEnabled }, | 792 { kPolicyAutoFillEnabled, Value::TYPE_BOOLEAN, key::kAutoFillEnabled }, |
793 { kPolicyDisabledPlugins, Value::TYPE_LIST, key::kDisabledPlugins }, | 793 { kPolicyDisabledPlugins, Value::TYPE_LIST, key::kDisabledPlugins }, |
794 { kPolicyApplicationLocale, Value::TYPE_STRING, | 794 { kPolicyApplicationLocaleValue, Value::TYPE_STRING, |
795 key::kApplicationLocaleValue }, | 795 key::kApplicationLocaleValue }, |
796 { kPolicySyncDisabled, Value::TYPE_BOOLEAN, key::kSyncDisabled }, | 796 { kPolicySyncDisabled, Value::TYPE_BOOLEAN, key::kSyncDisabled }, |
797 { kPolicyExtensionInstallAllowList, Value::TYPE_LIST, | 797 { kPolicyExtensionInstallWhitelist, Value::TYPE_LIST, |
798 key::kExtensionInstallAllowList }, | 798 key::kExtensionInstallWhitelist }, |
799 { kPolicyExtensionInstallDenyList, Value::TYPE_LIST, | 799 { kPolicyExtensionInstallBlacklist, Value::TYPE_LIST, |
800 key::kExtensionInstallDenyList }, | 800 key::kExtensionInstallBlacklist }, |
801 { kPolicyExtensionInstallForceList, Value::TYPE_LIST, | 801 { kPolicyExtensionInstallForcelist, Value::TYPE_LIST, |
802 key::kExtensionInstallForceList }, | 802 key::kExtensionInstallForcelist }, |
803 { kPolicyShowHomeButton, Value::TYPE_BOOLEAN, key::kShowHomeButton }, | 803 { kPolicyShowHomeButton, Value::TYPE_BOOLEAN, key::kShowHomeButton }, |
804 { kPolicyPrintingEnabled, Value::TYPE_BOOLEAN, key::kPrintingEnabled }, | 804 { kPolicyPrintingEnabled, Value::TYPE_BOOLEAN, key::kPrintingEnabled }, |
805 { kPolicyJavascriptEnabled, Value::TYPE_BOOLEAN, key::kJavascriptEnabled }, | 805 { kPolicyJavascriptEnabled, Value::TYPE_BOOLEAN, key::kJavascriptEnabled }, |
806 { kPolicySavingBrowserHistoryDisabled, Value::TYPE_BOOLEAN, | 806 { kPolicySavingBrowserHistoryDisabled, Value::TYPE_BOOLEAN, |
807 key::kSavingBrowserHistoryDisabled }, | 807 key::kSavingBrowserHistoryDisabled }, |
808 { kPolicyDeveloperToolsDisabled, Value::TYPE_BOOLEAN, | 808 { kPolicyDeveloperToolsDisabled, Value::TYPE_BOOLEAN, |
809 key::kDeveloperToolsDisabled }, | 809 key::kDeveloperToolsDisabled }, |
810 { kPolicyBlockThirdPartyCookies, Value::TYPE_BOOLEAN, | 810 { kPolicyBlockThirdPartyCookies, Value::TYPE_BOOLEAN, |
811 key::kBlockThirdPartyCookies }, | 811 key::kBlockThirdPartyCookies }, |
812 { kPolicyDefaultCookiesSetting, Value::TYPE_INTEGER, | 812 { kPolicyDefaultCookiesSetting, Value::TYPE_INTEGER, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 // Update the initialization flag. | 874 // Update the initialization flag. |
875 if (!initialization_complete_ && | 875 if (!initialization_complete_ && |
876 provider_->IsInitializationComplete()) { | 876 provider_->IsInitializationComplete()) { |
877 initialization_complete_ = true; | 877 initialization_complete_ = true; |
878 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, | 878 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, |
879 OnInitializationCompleted()); | 879 OnInitializationCompleted()); |
880 } | 880 } |
881 } | 881 } |
882 | 882 |
883 } // namespace policy | 883 } // namespace policy |
OLD | NEW |