page_zoom.h 1.5 KB

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