OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef COMPONENTS_UI_ZOOM_PAGE_ZOOM_H_ | 5 #ifndef COMPONENTS_ZOOM_PAGE_ZOOM_H_ |
6 #define COMPONENTS_UI_ZOOM_PAGE_ZOOM_H_ | 6 #define COMPONENTS_ZOOM_PAGE_ZOOM_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "content/public/common/page_zoom.h" | 11 #include "content/public/common/page_zoom.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class WebContents; | 14 class WebContents; |
15 } | 15 } |
16 | 16 |
17 namespace ui_zoom { | 17 namespace zoom { |
18 | 18 |
19 // This class provides a means of zooming pages according to a predetermined | 19 // This class provides a means of zooming pages according to a predetermined |
20 // set of zoom levels/factors. In future, the static methods in this class | 20 // set of zoom levels/factors. In future, the static methods in this class |
21 // can be made non-static, with PresetZoomX() being virtual, to allow clients | 21 // can be made non-static, with PresetZoomX() being virtual, to allow clients |
22 // to create custom sets of zoom levels. | 22 // to create custom sets of zoom levels. |
23 class PageZoom { | 23 class PageZoom { |
24 public: | 24 public: |
25 // Return a sorted vector of zoom factors. The vector will consist of preset | 25 // Return a sorted vector of zoom factors. The vector will consist of preset |
26 // values along with a custom value (if the custom value is not already | 26 // values along with a custom value (if the custom value is not already |
27 // represented.) | 27 // represented.) |
28 static std::vector<double> PresetZoomFactors(double custom_factor); | 28 static std::vector<double> PresetZoomFactors(double custom_factor); |
29 | 29 |
30 // Return a sorted vector of zoom levels. The vector will consist of preset | 30 // Return a sorted vector of zoom levels. The vector will consist of preset |
31 // values along with a custom value (if the custom value is not already | 31 // values along with a custom value (if the custom value is not already |
32 // represented.) | 32 // represented.) |
33 static std::vector<double> PresetZoomLevels(double custom_level); | 33 static std::vector<double> PresetZoomLevels(double custom_level); |
34 | 34 |
35 // Adjusts the zoom level of |web_contents|. | 35 // Adjusts the zoom level of |web_contents|. |
36 static void Zoom(content::WebContents* web_contents, content::PageZoom zoom); | 36 static void Zoom(content::WebContents* web_contents, content::PageZoom zoom); |
37 | 37 |
38 private: | 38 private: |
39 // We don't expect (currently) to create instances of this class. | 39 // We don't expect (currently) to create instances of this class. |
40 PageZoom() {} | 40 PageZoom() {} |
41 DISALLOW_COPY_AND_ASSIGN(PageZoom); | 41 DISALLOW_COPY_AND_ASSIGN(PageZoom); |
42 }; | 42 }; |
43 | 43 |
44 } // namespace ui_zoom | 44 } // namespace zoom |
45 | 45 |
46 #endif // COMPONENTS_UI_ZOOM_PAGE_ZOOM_H_ | 46 #endif // COMPONENTS_ZOOM_PAGE_ZOOM_H_ |
OLD | NEW |