| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_PUBLIC_COMMON_PAGE_ZOOM_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_PAGE_ZOOM_H_ |
| 6 #define CONTENT_PUBLIC_COMMON_PAGE_ZOOM_H_ | 6 #define CONTENT_PUBLIC_COMMON_PAGE_ZOOM_H_ |
| 7 | 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/logging.h" |
| 11 #include "base/values.h" |
| 8 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 9 | 13 |
| 10 namespace content { | 14 namespace content { |
| 11 | 15 |
| 12 // This enum is the parameter to various text/page zoom commands so we know | 16 // This enum is the parameter to various text/page zoom commands so we know |
| 13 // what the specific zoom command is. | 17 // what the specific zoom command is. |
| 14 enum PageZoom { | 18 enum PageZoom { |
| 15 PAGE_ZOOM_OUT = -1, | 19 PAGE_ZOOM_OUT = -1, |
| 16 PAGE_ZOOM_RESET = 0, | 20 PAGE_ZOOM_RESET = 0, |
| 17 PAGE_ZOOM_IN = 1, | 21 PAGE_ZOOM_IN = 1, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 32 CONTENT_EXPORT extern const double kEpsilon; | 36 CONTENT_EXPORT extern const double kEpsilon; |
| 33 | 37 |
| 34 // Test if two zoom values (either zoom factors or zoom levels) should be | 38 // Test if two zoom values (either zoom factors or zoom levels) should be |
| 35 // considered equal. | 39 // considered equal. |
| 36 CONTENT_EXPORT bool ZoomValuesEqual(double value_a, double value_b); | 40 CONTENT_EXPORT bool ZoomValuesEqual(double value_a, double value_b); |
| 37 | 41 |
| 38 // Converts between zoom factors and levels. | 42 // Converts between zoom factors and levels. |
| 39 CONTENT_EXPORT double ZoomLevelToZoomFactor(double zoom_level); | 43 CONTENT_EXPORT double ZoomLevelToZoomFactor(double zoom_level); |
| 40 CONTENT_EXPORT double ZoomFactorToZoomLevel(double factor); | 44 CONTENT_EXPORT double ZoomFactorToZoomLevel(double factor); |
| 41 | 45 |
| 46 // Defines how zoom changes are handled. |
| 47 // |kZoomModeDefault| results in default zoom behavior, i.e. zoom changes are |
| 48 // handled automatically and on a per-origin basis, meaning that other |
| 49 // tabs navigated to the same origin will also zoom. |
| 50 // |kZoomModeIsolated| results in zoom changes being handled automatically, |
| 51 // but on a per-tab basis. Tabs in this zoom mode will not be affected by |
| 52 // zoom changes in other tabs, and vice versa. |
| 53 // |kZoomModeManual| overrides the automatic handling of zoom changes. The |
| 54 // NOTIFICATION_WEB_CONTENTS_ZOOM_CHANGE notification will still be |
| 55 // dispatched, but the page will not actually be zoomed. These zoom changes |
| 56 // can be handled manually by listening for that notification. Zooming in |
| 57 // this mode is also on a per-tab basis. |
| 58 // |kZoomModeDisabled| disables all zooming in this tab. The tab will revert |
| 59 // to default (100%) zoom, and all attempted zoom changes will be ignored. |
| 60 enum ZoomMode { |
| 61 kZoomModeDefault, |
| 62 kZoomModeIsolated, |
| 63 kZoomModeManual, |
| 64 kZoomModeDisabled, |
| 65 }; |
| 66 |
| 67 // Details of a zoom change. |
| 68 struct ZoomChangeDetails { |
| 69 double old_zoom_level; |
| 70 double new_zoom_level; |
| 71 content::ZoomMode zoom_mode; |
| 72 }; |
| 73 |
| 42 } // namespace content | 74 } // namespace content |
| 43 | 75 |
| 44 #endif // CONTENT_PUBLIC_COMMON_PAGE_ZOOM_H_ | 76 #endif // CONTENT_PUBLIC_COMMON_PAGE_ZOOM_H_ |
| OLD | NEW |