Chromium Code Reviews| 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/ui/prefs/prefs_tab_helper.h" | 5 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 | 42 |
| 43 #if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(ENABLE_THEMES) | 43 #if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(ENABLE_THEMES) |
| 44 #include "chrome/browser/themes/theme_service.h" | 44 #include "chrome/browser/themes/theme_service.h" |
| 45 #include "chrome/browser/themes/theme_service_factory.h" | 45 #include "chrome/browser/themes/theme_service_factory.h" |
| 46 #endif | 46 #endif |
| 47 | 47 |
| 48 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
| 49 #include "base/win/windows_version.h" | 49 #include "base/win/windows_version.h" |
| 50 #endif | 50 #endif |
| 51 | 51 |
| 52 #if defined(ENABLE_EXTENSIONS) | |
| 53 #include "chrome/browser/chrome_content_browser_client.h" | |
| 54 #endif | |
| 55 | |
| 52 using content::WebContents; | 56 using content::WebContents; |
| 53 using content::WebPreferences; | 57 using content::WebPreferences; |
| 54 | 58 |
| 55 DEFINE_WEB_CONTENTS_USER_DATA_KEY(PrefsTabHelper); | 59 DEFINE_WEB_CONTENTS_USER_DATA_KEY(PrefsTabHelper); |
| 56 | 60 |
| 57 namespace { | 61 namespace { |
| 58 | 62 |
| 59 // The list of prefs we want to observe. | 63 // The list of prefs we want to observe. |
| 60 const char* kPrefsToObserve[] = { | 64 const char* kPrefsToObserve[] = { |
| 65 #if defined(ENABLE_EXTENSIONS) | |
| 66 prefs::kAnimationPolicy, | |
| 67 #endif | |
| 61 prefs::kDefaultCharset, | 68 prefs::kDefaultCharset, |
| 62 prefs::kDisable3DAPIs, | 69 prefs::kDisable3DAPIs, |
| 63 prefs::kEnableHyperlinkAuditing, | 70 prefs::kEnableHyperlinkAuditing, |
| 64 prefs::kWebKitAllowDisplayingInsecureContent, | 71 prefs::kWebKitAllowDisplayingInsecureContent, |
| 65 prefs::kWebKitAllowRunningInsecureContent, | 72 prefs::kWebKitAllowRunningInsecureContent, |
| 66 prefs::kWebKitDefaultFixedFontSize, | 73 prefs::kWebKitDefaultFixedFontSize, |
| 67 prefs::kWebKitDefaultFontSize, | 74 prefs::kWebKitDefaultFontSize, |
| 68 prefs::kWebKitDomPasteEnabled, | 75 prefs::kWebKitDomPasteEnabled, |
| 69 #if defined(OS_ANDROID) | 76 #if defined(OS_ANDROID) |
| 70 prefs::kWebKitFontScaleFactor, | 77 prefs::kWebKitFontScaleFactor, |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 pref_store->RegisterOverlayPref(prefs::kSaveFileDefaultDirectory); | 515 pref_store->RegisterOverlayPref(prefs::kSaveFileDefaultDirectory); |
| 509 #if defined(OS_ANDROID) || defined(OS_IOS) | 516 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 510 pref_store->RegisterOverlayPref(prefs::kProxy); | 517 pref_store->RegisterOverlayPref(prefs::kProxy); |
| 511 #endif // defined(OS_ANDROID) || defined(OS_IOS) | 518 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
| 512 } | 519 } |
| 513 | 520 |
| 514 // static | 521 // static |
| 515 void PrefsTabHelper::RegisterProfilePrefs( | 522 void PrefsTabHelper::RegisterProfilePrefs( |
| 516 user_prefs::PrefRegistrySyncable* registry) { | 523 user_prefs::PrefRegistrySyncable* registry) { |
| 517 WebPreferences pref_defaults; | 524 WebPreferences pref_defaults; |
| 525 #if defined(ENABLE_EXTENSIONS) | |
| 526 registry->RegisterStringPref( | |
| 527 prefs::kAnimationPolicy, | |
| 528 chrome::kAnimationPolicyAllowed, | |
| 529 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | |
|
Lei Zhang
2015/01/30 20:18:08
Should this be a syncable pref? I don't know the a
je_julie(Not used)
2015/01/31 07:25:35
There is no specific reason using SYNCABLE_PREF.
| |
| 530 #endif | |
| 518 registry->RegisterBooleanPref( | 531 registry->RegisterBooleanPref( |
| 519 prefs::kWebKitJavascriptEnabled, | 532 prefs::kWebKitJavascriptEnabled, |
| 520 pref_defaults.javascript_enabled, | 533 pref_defaults.javascript_enabled, |
| 521 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 534 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 522 registry->RegisterBooleanPref( | 535 registry->RegisterBooleanPref( |
| 523 prefs::kWebKitWebSecurityEnabled, | 536 prefs::kWebKitWebSecurityEnabled, |
| 524 pref_defaults.web_security_enabled, | 537 pref_defaults.web_security_enabled, |
| 525 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 538 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 526 registry->RegisterBooleanPref( | 539 registry->RegisterBooleanPref( |
| 527 prefs::kWebKitJavascriptCanOpenWindowsAutomatically, | 540 prefs::kWebKitJavascriptCanOpenWindowsAutomatically, |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 733 } | 746 } |
| 734 } | 747 } |
| 735 | 748 |
| 736 void PrefsTabHelper::OnWebPrefChanged(const std::string& pref_name) { | 749 void PrefsTabHelper::OnWebPrefChanged(const std::string& pref_name) { |
| 737 #if !defined(OS_ANDROID) | 750 #if !defined(OS_ANDROID) |
| 738 OnFontFamilyPrefChanged(pref_name); | 751 OnFontFamilyPrefChanged(pref_name); |
| 739 #endif | 752 #endif |
| 740 | 753 |
| 741 web_contents_->GetRenderViewHost()->OnWebkitPreferencesChanged(); | 754 web_contents_->GetRenderViewHost()->OnWebkitPreferencesChanged(); |
| 742 } | 755 } |
| OLD | NEW |