Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8530)

Unified Diff: chrome/browser/ui/prefs/prefs_tab_helper.cc

Issue 541103002: Introduce ChromeZoomLevelPref, make zoom level prefs independent of profile prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/prefs/prefs_tab_helper.cc
diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.cc b/chrome/browser/ui/prefs/prefs_tab_helper.cc
index 816e08b60f60092d0f97371f9dc9d6261dbc86bb..5ef82d9df3d67524d1c96d63d1e5bc518fe2307e 100644
--- a/chrome/browser/ui/prefs/prefs_tab_helper.cc
+++ b/chrome/browser/ui/prefs/prefs_tab_helper.cc
@@ -15,6 +15,8 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_preferences_util.h"
+#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
+#include "chrome/browser/ui/zoom/zoom_controller.h"
#include "chrome/common/pref_font_webkit_names.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_names_util.h"
@@ -24,6 +26,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/common/renderer_preferences.h"
#include "content/public/common/web_preferences.h"
#include "grit/platform_locale_settings.h"
#include "third_party/icu/source/common/unicode/uchar.h"
@@ -318,10 +321,19 @@ PrefsTabHelper::PrefsTabHelper(WebContents* contents)
PrefService* prefs = GetProfile()->GetPrefs();
pref_change_registrar_.Init(prefs);
if (prefs) {
+ // TODO(wjmaclean): Convert this to use the content-specific zoom-level
+ // prefs when HostZoomMap moves to StoragePartition.
+ chrome::ChromeZoomLevelPrefs* zoom_level_prefs =
+ GetProfile()->GetZoomLevelPrefs();
+
base::Closure renderer_callback = base::Bind(
&PrefsTabHelper::UpdateRendererPreferences, base::Unretained(this));
+ // Not all tests will create zoom_level_prefs.
battre 2014/10/08 11:27:10 Also no incognito tabs. Are you sure this is ok?
wjmaclean 2014/10/10 14:40:29 I think so. Certainly the zoom levels in incognito
+ if (zoom_level_prefs) {
+ default_zoom_level_subscription_ =
+ zoom_level_prefs->RegisterDefaultZoomLevelCallback(renderer_callback);
+ }
pref_change_registrar_.Add(prefs::kAcceptLanguages, renderer_callback);
- pref_change_registrar_.Add(prefs::kDefaultZoomLevel, renderer_callback);
pref_change_registrar_.Add(prefs::kEnableDoNotTrack, renderer_callback);
pref_change_registrar_.Add(prefs::kEnableReferrers, renderer_callback);
@@ -359,11 +371,15 @@ PrefsTabHelper::PrefsTabHelper(WebContents* contents)
webkit_callback);
}
- renderer_preferences_util::UpdateFromSystemSettings(
- web_contents_->GetMutableRendererPrefs(), GetProfile());
+ content::RendererPreferences* render_prefs =
+ web_contents_->GetMutableRendererPrefs();
+ renderer_preferences_util::UpdateFromSystemSettings(render_prefs,
+ GetProfile(),
+ web_contents_);
#if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(ENABLE_THEMES)
- registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
+ registrar_.Add(this,
+ chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
content::Source<ThemeService>(
ThemeServiceFactory::GetForProfile(GetProfile())));
#endif
@@ -567,8 +583,10 @@ void PrefsTabHelper::UpdateWebPreferences() {
}
void PrefsTabHelper::UpdateRendererPreferences() {
+ content::RendererPreferences* prefs =
+ web_contents_->GetMutableRendererPrefs();
renderer_preferences_util::UpdateFromSystemSettings(
- web_contents_->GetMutableRendererPrefs(), GetProfile());
+ prefs, GetProfile(), web_contents_);
web_contents_->GetRenderViewHost()->SyncRendererPrefs();
}

Powered by Google App Engine
This is Rietveld 408576698