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

Unified Diff: components/ui/zoom/page_zoom.cc

Issue 847703003: Refactor to move chrome_page_zoom functions to components/ui/zoom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build. Created 5 years, 11 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: components/ui/zoom/page_zoom.cc
diff --git a/chrome/browser/chrome_page_zoom.cc b/components/ui/zoom/page_zoom.cc
similarity index 86%
rename from chrome/browser/chrome_page_zoom.cc
rename to components/ui/zoom/page_zoom.cc
index 3a6a75f2f9050375f4bdcafdd2aa99f457f0293c..90f43fc14450402fa0bf1043f70b47103140b8c1 100644
--- a/chrome/browser/chrome_page_zoom.cc
+++ b/components/ui/zoom/page_zoom.cc
@@ -1,14 +1,14 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chrome_page_zoom.h"
+#include "components/ui/zoom/page_zoom.h"
#include <algorithm>
#include <cmath>
#include "base/prefs/pref_service.h"
-#include "chrome/browser/chrome_page_zoom_constants.h"
+#include "components/ui/zoom/page_zoom_constants.h"
#include "components/ui/zoom/zoom_controller.h"
#include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/render_view_host.h"
@@ -19,7 +19,7 @@
using base::UserMetricsAction;
-namespace chrome_page_zoom {
+namespace {
enum PageZoomValueType {
PAGE_ZOOM_VALUE_TYPE_FACTOR,
@@ -33,8 +33,8 @@ std::vector<double> PresetZoomValues(PageZoomValueType value_type,
// sorted order.
std::vector<double> zoom_values;
bool found_custom = false;
- for (size_t i = 0; i < kPresetZoomFactorsSize; i++) {
- double zoom_value = kPresetZoomFactors[i];
+ for (size_t i = 0; i < ui_zoom::kPresetZoomFactorsSize; i++) {
+ double zoom_value = ui_zoom::kPresetZoomFactors[i];
if (value_type == PAGE_ZOOM_VALUE_TYPE_LEVEL)
zoom_value = content::ZoomFactorToZoomLevel(zoom_value);
if (content::ZoomValuesEqual(zoom_value, custom_value))
@@ -56,15 +56,23 @@ std::vector<double> PresetZoomValues(PageZoomValueType value_type,
return zoom_values;
}
-std::vector<double> PresetZoomFactors(double custom_factor) {
+} // namespace anonymous
+
+namespace ui_zoom {
+
+// Static.
Fady Samuel 2015/01/14 17:38:15 nit: lowercase and no period // static
wjmaclean 2015/01/14 17:56:49 Done.
+std::vector<double> PageZoom::PresetZoomFactors(double custom_factor) {
return PresetZoomValues(PAGE_ZOOM_VALUE_TYPE_FACTOR, custom_factor);
}
-std::vector<double> PresetZoomLevels(double custom_level) {
+// Static.
Fady Samuel 2015/01/14 17:38:15 nit: // static
+std::vector<double> PageZoom::PresetZoomLevels(double custom_level) {
return PresetZoomValues(PAGE_ZOOM_VALUE_TYPE_LEVEL, custom_level);
}
-void Zoom(content::WebContents* web_contents, content::PageZoom zoom) {
+// Static.
Fady Samuel 2015/01/14 17:38:14 nit: // static
+void PageZoom::Zoom(content::WebContents* web_contents,
+ content::PageZoom zoom) {
ui_zoom::ZoomController* zoom_controller =
ui_zoom::ZoomController::FromWebContents(web_contents);
DCHECK(zoom_controller);
@@ -115,4 +123,4 @@ void Zoom(content::WebContents* web_contents, content::PageZoom zoom) {
}
}
-} // namespace chrome_page_zoom
+} // namespace ui_zoom

Powered by Google App Engine
This is Rietveld 408576698