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
3 // found in the LICENSE file.
4 
5 #ifndef COMPONENTS_ZOOM_PAGE_ZOOM_H_
6 #define COMPONENTS_ZOOM_PAGE_ZOOM_H_
7 
8 #include <vector>
9 
10 #include "base/macros.h"
11 #include "content/public/common/page_zoom.h"
12 
13 namespace content {
14 class WebContents;
15 }
16 
17 namespace zoom {
18 
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
21 // can be made non-static, with PresetZoomX() being virtual, to allow clients
22 // to create custom sets of zoom levels.
23 class PageZoom {
24  public:
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
27   // represented.)
28   static std::vector<double> PresetZoomFactors(double custom_factor);
29 
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
32   // represented.)
33   static std::vector<double> PresetZoomLevels(double custom_level);
34 
35   // Adjusts the zoom level of |web_contents|.
36   static void Zoom(content::WebContents* web_contents, content::PageZoom zoom);
37 
38  private:
39   // We don't expect (currently) to create instances of this class.
PageZoom()40   PageZoom() {}
41   DISALLOW_COPY_AND_ASSIGN(PageZoom);
42 };
43 
44 }  // namespace zoom
45 
46 #endif  // COMPONENTS_ZOOM_PAGE_ZOOM_H_
47