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/chrome_page_zoom.h" | 5 #include "chrome/browser/chrome_page_zoom.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
11 #include "chrome/browser/chrome_page_zoom_constants.h" | 11 #include "chrome/browser/chrome_page_zoom_constants.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/zoom/zoom_controller.h" | 13 #include "components/ui/zoom/zoom_controller.h" |
14 #include "content/public/browser/host_zoom_map.h" | 14 #include "content/public/browser/host_zoom_map.h" |
15 #include "content/public/browser/render_view_host.h" | 15 #include "content/public/browser/render_view_host.h" |
16 #include "content/public/browser/user_metrics.h" | 16 #include "content/public/browser/user_metrics.h" |
17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
18 #include "content/public/common/page_zoom.h" | 18 #include "content/public/common/page_zoom.h" |
19 #include "content/public/common/renderer_preferences.h" | 19 #include "content/public/common/renderer_preferences.h" |
20 | 20 |
21 using base::UserMetricsAction; | 21 using base::UserMetricsAction; |
22 | 22 |
23 namespace chrome_page_zoom { | 23 namespace chrome_page_zoom { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 std::vector<double> PresetZoomFactors(double custom_factor) { | 60 std::vector<double> PresetZoomFactors(double custom_factor) { |
61 return PresetZoomValues(PAGE_ZOOM_VALUE_TYPE_FACTOR, custom_factor); | 61 return PresetZoomValues(PAGE_ZOOM_VALUE_TYPE_FACTOR, custom_factor); |
62 } | 62 } |
63 | 63 |
64 std::vector<double> PresetZoomLevels(double custom_level) { | 64 std::vector<double> PresetZoomLevels(double custom_level) { |
65 return PresetZoomValues(PAGE_ZOOM_VALUE_TYPE_LEVEL, custom_level); | 65 return PresetZoomValues(PAGE_ZOOM_VALUE_TYPE_LEVEL, custom_level); |
66 } | 66 } |
67 | 67 |
68 void Zoom(content::WebContents* web_contents, content::PageZoom zoom) { | 68 void Zoom(content::WebContents* web_contents, content::PageZoom zoom) { |
69 ZoomController* zoom_controller = | 69 ui_zoom::ZoomController* zoom_controller = |
70 ZoomController::FromWebContents(web_contents); | 70 ui_zoom::ZoomController::FromWebContents(web_contents); |
71 DCHECK(zoom_controller); | 71 DCHECK(zoom_controller); |
72 | 72 |
73 double current_zoom_level = zoom_controller->GetZoomLevel(); | 73 double current_zoom_level = zoom_controller->GetZoomLevel(); |
74 double default_zoom_level = zoom_controller->GetDefaultZoomLevel(); | 74 double default_zoom_level = zoom_controller->GetDefaultZoomLevel(); |
75 | 75 |
76 if (zoom == content::PAGE_ZOOM_RESET) { | 76 if (zoom == content::PAGE_ZOOM_RESET) { |
77 zoom_controller->SetZoomLevel(default_zoom_level); | 77 zoom_controller->SetZoomLevel(default_zoom_level); |
78 content::RecordAction(UserMetricsAction("ZoomNormal")); | 78 content::RecordAction(UserMetricsAction("ZoomNormal")); |
79 return; | 79 return; |
80 } | 80 } |
(...skipping 29 matching lines...) Expand all Loading... |
110 zoom_controller->SetZoomLevel(zoom_level); | 110 zoom_controller->SetZoomLevel(zoom_level); |
111 content::RecordAction(UserMetricsAction("ZoomPlus")); | 111 content::RecordAction(UserMetricsAction("ZoomPlus")); |
112 return; | 112 return; |
113 } | 113 } |
114 } | 114 } |
115 content::RecordAction(UserMetricsAction("ZoomPlus_AtMaximum")); | 115 content::RecordAction(UserMetricsAction("ZoomPlus_AtMaximum")); |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 } // namespace chrome_page_zoom | 119 } // namespace chrome_page_zoom |
OLD | NEW |