Home | History | Annotate | Download | only in common
      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 
     10 namespace content {
     11 
     12 // This enum is the parameter to various text/page zoom commands so we know
     13 // what the specific zoom command is.
     14 enum 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.
     22 CONTENT_EXPORT extern const double kMinimumZoomFactor;
     23 
     24 // The maximum zoom factor permitted for a page. This is an alternative to
     25 // WebView::maxTextSizeMultiplier.
     26 CONTENT_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.
     32 CONTENT_EXPORT extern const double kEpsilon;
     33 
     34 // Test if two zoom values (either zoom factors or zoom levels) should be
     35 // considered equal.
     36 CONTENT_EXPORT bool ZoomValuesEqual(double value_a, double value_b);
     37 
     38 // Converts between zoom factors and levels.
     39 CONTENT_EXPORT double ZoomLevelToZoomFactor(double zoom_level);
     40 CONTENT_EXPORT double ZoomFactorToZoomLevel(double factor);
     41 
     42 }  // namespace content
     43 
     44 #endif  // CONTENT_PUBLIC_COMMON_PAGE_ZOOM_H_
     45