| 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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 l10n_util::GetStringUTF8(IDS_USES_UNIVERSAL_DETECTOR) == "true", | 664 l10n_util::GetStringUTF8(IDS_USES_UNIVERSAL_DETECTOR) == "true", |
| 658 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 665 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 659 registry->RegisterStringPref( | 666 registry->RegisterStringPref( |
| 660 prefs::kStaticEncodings, | 667 prefs::kStaticEncodings, |
| 661 l10n_util::GetStringUTF8(IDS_STATIC_ENCODING_LIST), | 668 l10n_util::GetStringUTF8(IDS_STATIC_ENCODING_LIST), |
| 662 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 669 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 663 registry->RegisterStringPref( | 670 registry->RegisterStringPref( |
| 664 prefs::kRecentlySelectedEncoding, | 671 prefs::kRecentlySelectedEncoding, |
| 665 std::string(), | 672 std::string(), |
| 666 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 673 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 674 #if defined(ENABLE_EXTENSIONS) |
| 675 chrome::RegisterAnimationPolicyPrefs(registry); |
| 676 #endif |
| 667 } | 677 } |
| 668 | 678 |
| 669 // static | 679 // static |
| 670 void PrefsTabHelper::GetServiceInstance() { | 680 void PrefsTabHelper::GetServiceInstance() { |
| 671 PrefWatcherFactory::GetInstance(); | 681 PrefWatcherFactory::GetInstance(); |
| 672 } | 682 } |
| 673 | 683 |
| 674 void PrefsTabHelper::Observe(int type, | 684 void PrefsTabHelper::Observe(int type, |
| 675 const content::NotificationSource& source, | 685 const content::NotificationSource& source, |
| 676 const content::NotificationDetails& details) { | 686 const content::NotificationDetails& details) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 } | 743 } |
| 734 } | 744 } |
| 735 | 745 |
| 736 void PrefsTabHelper::OnWebPrefChanged(const std::string& pref_name) { | 746 void PrefsTabHelper::OnWebPrefChanged(const std::string& pref_name) { |
| 737 #if !defined(OS_ANDROID) | 747 #if !defined(OS_ANDROID) |
| 738 OnFontFamilyPrefChanged(pref_name); | 748 OnFontFamilyPrefChanged(pref_name); |
| 739 #endif | 749 #endif |
| 740 | 750 |
| 741 web_contents_->GetRenderViewHost()->OnWebkitPreferencesChanged(); | 751 web_contents_->GetRenderViewHost()->OnWebkitPreferencesChanged(); |
| 742 } | 752 } |
| OLD | NEW |