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

Unified Diff: chrome/browser/chrome_page_zoom.cc

Issue 10826136: Fixes chrome_page_zoom::Zoom(). First, correctly retrieves the default zoom level from the user Pro… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_page_zoom.cc
diff --git a/chrome/browser/chrome_page_zoom.cc b/chrome/browser/chrome_page_zoom.cc
index cbd8c56f7206e5b0ad57af40b805dad4832e1872..e18692bfece6ce19d45a769900db42f52448516e 100644
--- a/chrome/browser/chrome_page_zoom.cc
+++ b/chrome/browser/chrome_page_zoom.cc
@@ -8,6 +8,9 @@
#include <cmath>
#include "chrome/browser/chrome_page_zoom_constants.h"
+#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/pref_names.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
@@ -63,16 +66,17 @@ std::vector<double> PresetZoomLevels(double custom_level) {
void Zoom(content::WebContents* web_contents, content::PageZoom zoom) {
content::RenderViewHost* host = web_contents->GetRenderViewHost();
+ double current_zoom_level = web_contents->GetZoomLevel();
+ double default_zoom_level =
+ Profile::FromBrowserContext(web_contents->GetBrowserContext())->
+ GetPrefs()->GetDouble(prefs::kDefaultZoomLevel);
+
if (zoom == content::PAGE_ZOOM_RESET) {
- host->SetZoomLevel(0);
+ host->SetZoomLevel(default_zoom_level);
content::RecordAction(UserMetricsAction("ZoomNormal"));
return;
}
- double current_zoom_level = web_contents->GetZoomLevel();
- double default_zoom_level =
- web_contents->GetMutableRendererPrefs()->default_zoom_level;
-
// Generate a vector of zoom levels from an array of known presets along with
// the default level added if necessary.
std::vector<double> zoom_levels = PresetZoomLevels(default_zoom_level);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698