| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extensions/api/settings_private/prefs_util.h" | 5 #include "chrome/browser/extensions/api/settings_private/prefs_util.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/extensions/chrome_extension_function.h" | 9 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 10 #include "chrome/browser/extensions/settings_api_helpers.h" | 10 #include "chrome/browser/extensions/settings_api_helpers.h" |
| 11 #include "chrome/browser/prefs/session_startup_pref.h" | 11 #include "chrome/browser/prefs/session_startup_pref.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 14 #include "components/autofill/core/common/autofill_pref_names.h" | 14 #include "components/autofill/core/common/autofill_pref_names.h" |
| 15 #include "components/bookmarks/common/bookmark_pref_names.h" | 15 #include "components/bookmarks/common/bookmark_pref_names.h" |
| 16 #include "components/browsing_data/core/pref_names.h" | 16 #include "components/browsing_data/core/pref_names.h" |
| 17 #include "components/content_settings/core/common/pref_names.h" | 17 #include "components/content_settings/core/common/pref_names.h" |
| 18 #include "components/drive/drive_pref_names.h" | 18 #include "components/drive/drive_pref_names.h" |
| 19 #include "components/password_manager/core/common/password_manager_pref_names.h" | 19 #include "components/password_manager/core/common/password_manager_pref_names.h" |
| 20 #include "components/prefs/pref_service.h" | 20 #include "components/prefs/pref_service.h" |
| 21 #include "components/proxy_config/proxy_config_pref_names.h" | 21 #include "components/proxy_config/proxy_config_pref_names.h" |
| 22 #include "components/safe_browsing_db/safe_browsing_prefs.h" | 22 #include "components/safe_browsing_db/safe_browsing_prefs.h" |
| 23 #include "components/search_engines/search_engines_pref_names.h" | 23 #include "components/search_engines/default_search_manager.h" |
| 24 #include "components/spellcheck/browser/pref_names.h" | 24 #include "components/spellcheck/browser/pref_names.h" |
| 25 #include "components/translate/core/browser/translate_pref_names.h" | 25 #include "components/translate/core/browser/translate_pref_names.h" |
| 26 #include "components/translate/core/browser/translate_prefs.h" | 26 #include "components/translate/core/browser/translate_prefs.h" |
| 27 #include "components/url_formatter/url_fixer.h" | 27 #include "components/url_formatter/url_fixer.h" |
| 28 #include "extensions/browser/extension_pref_value_map.h" | 28 #include "extensions/browser/extension_pref_value_map.h" |
| 29 #include "extensions/browser/extension_pref_value_map_factory.h" | 29 #include "extensions/browser/extension_pref_value_map_factory.h" |
| 30 #include "extensions/browser/extension_registry.h" | 30 #include "extensions/browser/extension_registry.h" |
| 31 #include "extensions/browser/extension_system.h" | 31 #include "extensions/browser/extension_system.h" |
| 32 #include "extensions/browser/management_policy.h" | 32 #include "extensions/browser/management_policy.h" |
| 33 #include "extensions/common/extension.h" | 33 #include "extensions/common/extension.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 (*s_whitelist)[::prefs::kEnableTranslate] = | 165 (*s_whitelist)[::prefs::kEnableTranslate] = |
| 166 settings_private::PrefType::PREF_TYPE_BOOLEAN; | 166 settings_private::PrefType::PREF_TYPE_BOOLEAN; |
| 167 (*s_whitelist)[translate::TranslatePrefs::kPrefTranslateBlockedLanguages] = | 167 (*s_whitelist)[translate::TranslatePrefs::kPrefTranslateBlockedLanguages] = |
| 168 settings_private::PrefType::PREF_TYPE_LIST; | 168 settings_private::PrefType::PREF_TYPE_LIST; |
| 169 #if defined(OS_CHROMEOS) | 169 #if defined(OS_CHROMEOS) |
| 170 (*s_whitelist)[::prefs::kLanguageImeMenuActivated] = | 170 (*s_whitelist)[::prefs::kLanguageImeMenuActivated] = |
| 171 settings_private::PrefType::PREF_TYPE_BOOLEAN; | 171 settings_private::PrefType::PREF_TYPE_BOOLEAN; |
| 172 #endif | 172 #endif |
| 173 | 173 |
| 174 // Search page. | 174 // Search page. |
| 175 (*s_whitelist)[::prefs::kDefaultSearchProviderEnabled] = | 175 (*s_whitelist)[DefaultSearchManager::kDefaultSearchProviderDataPrefName] = |
| 176 settings_private::PrefType::PREF_TYPE_BOOLEAN; | 176 settings_private::PrefType::PREF_TYPE_DICTIONARY; |
| 177 (*s_whitelist)[::prefs::kGoogleNowLauncherEnabled] = | 177 (*s_whitelist)[::prefs::kGoogleNowLauncherEnabled] = |
| 178 settings_private::PrefType::PREF_TYPE_BOOLEAN; | 178 settings_private::PrefType::PREF_TYPE_BOOLEAN; |
| 179 | 179 |
| 180 // Site Settings prefs. | 180 // Site Settings prefs. |
| 181 (*s_whitelist)[::prefs::kBlockThirdPartyCookies] = | 181 (*s_whitelist)[::prefs::kBlockThirdPartyCookies] = |
| 182 settings_private::PrefType::PREF_TYPE_BOOLEAN; | 182 settings_private::PrefType::PREF_TYPE_BOOLEAN; |
| 183 (*s_whitelist)[::prefs::kPluginsAlwaysOpenPdfExternally] = | 183 (*s_whitelist)[::prefs::kPluginsAlwaysOpenPdfExternally] = |
| 184 settings_private::PrefType::PREF_TYPE_BOOLEAN; | 184 settings_private::PrefType::PREF_TYPE_BOOLEAN; |
| 185 (*s_whitelist)[::prefs::kEnableDRM] = | 185 (*s_whitelist)[::prefs::kEnableDRM] = |
| 186 settings_private::PrefType::PREF_TYPE_BOOLEAN; | 186 settings_private::PrefType::PREF_TYPE_BOOLEAN; |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 int restore_on_startup; | 751 int restore_on_startup; |
| 752 CHECK(pref_object.value->GetAsInteger(&restore_on_startup)); | 752 CHECK(pref_object.value->GetAsInteger(&restore_on_startup)); |
| 753 | 753 |
| 754 if (restore_on_startup == SessionStartupPref::kPrefValueURLs) | 754 if (restore_on_startup == SessionStartupPref::kPrefValueURLs) |
| 755 return GetExtensionOverridingStartupPages(profile_); | 755 return GetExtensionOverridingStartupPages(profile_); |
| 756 } | 756 } |
| 757 | 757 |
| 758 if (pref_object.key == ::prefs::kURLsToRestoreOnStartup) | 758 if (pref_object.key == ::prefs::kURLsToRestoreOnStartup) |
| 759 return GetExtensionOverridingStartupPages(profile_); | 759 return GetExtensionOverridingStartupPages(profile_); |
| 760 | 760 |
| 761 if (pref_object.key == ::prefs::kDefaultSearchProviderEnabled) | 761 if (pref_object.key == |
| 762 DefaultSearchManager::kDefaultSearchProviderDataPrefName) { |
| 762 return GetExtensionOverridingSearchEngine(profile_); | 763 return GetExtensionOverridingSearchEngine(profile_); |
| 764 } |
| 763 | 765 |
| 764 if (pref_object.key == proxy_config::prefs::kProxy) | 766 if (pref_object.key == proxy_config::prefs::kProxy) |
| 765 return GetExtensionOverridingProxy(profile_); | 767 return GetExtensionOverridingProxy(profile_); |
| 766 | 768 |
| 767 // If it's none of the above, attempt a more general strategy. | 769 // If it's none of the above, attempt a more general strategy. |
| 768 std::string extension_id = | 770 std::string extension_id = |
| 769 ExtensionPrefValueMapFactory::GetForBrowserContext(profile_) | 771 ExtensionPrefValueMapFactory::GetForBrowserContext(profile_) |
| 770 ->GetExtensionControllingPref(pref_object.key); | 772 ->GetExtensionControllingPref(pref_object.key); |
| 771 if (extension_id.empty()) | 773 if (extension_id.empty()) |
| 772 return nullptr; | 774 return nullptr; |
| 773 | 775 |
| 774 return ExtensionRegistry::Get(profile_)->GetExtensionById( | 776 return ExtensionRegistry::Get(profile_)->GetExtensionById( |
| 775 extension_id, ExtensionRegistry::ENABLED); | 777 extension_id, ExtensionRegistry::ENABLED); |
| 776 } | 778 } |
| 777 | 779 |
| 778 } // namespace extensions | 780 } // namespace extensions |
| OLD | NEW |