| 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/accessibility/animation_policy_prefs.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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 // not be really critical after all. | 627 // not be really critical after all. |
| 621 if (browser_script != pref_script) { | 628 if (browser_script != pref_script) { |
| 622 registry->RegisterStringPref( | 629 registry->RegisterStringPref( |
| 623 pref.pref_name, | 630 pref.pref_name, |
| 624 l10n_util::GetStringUTF8(pref.resource_id), | 631 l10n_util::GetStringUTF8(pref.resource_id), |
| 625 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 632 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 626 fonts_with_defaults.insert(pref.pref_name); | 633 fonts_with_defaults.insert(pref.pref_name); |
| 627 } | 634 } |
| 628 } | 635 } |
| 629 | 636 |
| 637 #if defined(ENABLE_EXTENSIONS) |
| 638 RegisterAnimationPolicyPrefs(registry); |
| 639 #endif |
| 640 |
| 630 // Register per-script font prefs that don't have defaults. | 641 // Register per-script font prefs that don't have defaults. |
| 631 #if !defined(OS_ANDROID) | 642 #if !defined(OS_ANDROID) |
| 632 RegisterFontFamilyPrefs(registry, fonts_with_defaults); | 643 RegisterFontFamilyPrefs(registry, fonts_with_defaults); |
| 633 #endif | 644 #endif |
| 634 | 645 |
| 635 RegisterLocalizedFontPref( | 646 RegisterLocalizedFontPref( |
| 636 registry, | 647 registry, |
| 637 prefs::kWebKitDefaultFontSize, | 648 prefs::kWebKitDefaultFontSize, |
| 638 IDS_DEFAULT_FONT_SIZE, | 649 IDS_DEFAULT_FONT_SIZE, |
| 639 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 650 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 } | 744 } |
| 734 } | 745 } |
| 735 | 746 |
| 736 void PrefsTabHelper::OnWebPrefChanged(const std::string& pref_name) { | 747 void PrefsTabHelper::OnWebPrefChanged(const std::string& pref_name) { |
| 737 #if !defined(OS_ANDROID) | 748 #if !defined(OS_ANDROID) |
| 738 OnFontFamilyPrefChanged(pref_name); | 749 OnFontFamilyPrefChanged(pref_name); |
| 739 #endif | 750 #endif |
| 740 | 751 |
| 741 web_contents_->GetRenderViewHost()->OnWebkitPreferencesChanged(); | 752 web_contents_->GetRenderViewHost()->OnWebkitPreferencesChanged(); |
| 742 } | 753 } |
| OLD | NEW |