page_zoom.h revision 58e6fbe4ee35d65e14b626c557d37565bf8ad179
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
3// found in the LICENSE file.
4
5#ifndef CONTENT_PUBLIC_COMMON_PAGE_ZOOM_H_
6#define CONTENT_PUBLIC_COMMON_PAGE_ZOOM_H_
7
8#include "content/common/content_export.h"
9
10namespace content {
11
12// This enum is the parameter to various text/page zoom commands so we know
13// what the specific zoom command is.
14enum PageZoom {
15  PAGE_ZOOM_OUT   = -1,
16  PAGE_ZOOM_RESET = 0,
17  PAGE_ZOOM_IN    = 1,
18};
19
20// The minimum zoom factor permitted for a page. This is an alternative to
21// WebView::minTextSizeMultiplier.
22CONTENT_EXPORT extern const double kMinimumZoomFactor;
23
24// The maximum zoom factor permitted for a page. This is an alternative to
25// WebView::maxTextSizeMultiplier.
26CONTENT_EXPORT extern const double kMaximumZoomFactor;
27
28// Epsilon value for comparing two floating-point zoom values. We don't use
29// std::numeric_limits<> because it is too precise for zoom values. Zoom
30// values lose precision due to factor/level conversions. A value of 0.001
31// is precise enough for zoom value comparisons.
32CONTENT_EXPORT extern const double kEpsilon;
33
34// Test if two zoom values (either zoom factors or zoom levels) should be
35// considered equal.
36CONTENT_EXPORT bool ZoomValuesEqual(double value_a, double value_b);
37
38// Converts between zoom factors and levels.
39CONTENT_EXPORT double ZoomLevelToZoomFactor(double zoom_level);
40CONTENT_EXPORT double ZoomFactorToZoomLevel(double factor);
41
42}  // namespace content
43
44#endif  // CONTENT_PUBLIC_COMMON_PAGE_ZOOM_H_
45