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_BROWSER_RENDERER_HOST_DIP_UTIL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_ |
7 | 7 |
8 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
9 | 9 |
| 10 namespace cc { |
| 11 class CompositorFrameMetadata; |
| 12 } |
| 13 |
10 namespace gfx { | 14 namespace gfx { |
11 class Point; | 15 class Point; |
12 class Rect; | 16 class Rect; |
13 class Size; | 17 class Size; |
14 } // namespace gfx | 18 } // namespace gfx |
15 | 19 |
16 namespace content { | 20 namespace content { |
17 class RenderWidgetHostView; | 21 class RenderWidgetHostView; |
18 | 22 |
19 // Returns scale factor of the display nearest to |view|. | 23 // Returns scale factor of the display nearest to |view|. |
20 // Returns 1.0f if the platform does not support DIP. | 24 // Returns 1.0f if the platform does not support DIP. |
21 CONTENT_EXPORT float GetScaleFactorForView(const RenderWidgetHostView* view); | 25 CONTENT_EXPORT float GetScaleFactorForView(const RenderWidgetHostView* view); |
22 | 26 |
23 // Utility functions that convert point/size/rect between DIP and pixel | 27 // Utility functions that convert point/size/rect between DIP and pixel |
24 // coordinate system. | 28 // coordinate system. |
25 CONTENT_EXPORT gfx::Point ConvertViewPointToDIP( | 29 CONTENT_EXPORT gfx::Point ConvertViewPointToDIP( |
26 const RenderWidgetHostView* view, const gfx::Point& point_in_pixel); | 30 const RenderWidgetHostView* view, const gfx::Point& point_in_pixel); |
27 CONTENT_EXPORT gfx::Size ConvertViewSizeToPixel( | 31 CONTENT_EXPORT gfx::Size ConvertViewSizeToPixel( |
28 const RenderWidgetHostView* view, const gfx::Size& size_in_dip); | 32 const RenderWidgetHostView* view, const gfx::Size& size_in_dip); |
29 CONTENT_EXPORT gfx::Rect ConvertViewRectToPixel( | 33 CONTENT_EXPORT gfx::Rect ConvertViewRectToPixel( |
30 const RenderWidgetHostView* view, const gfx::Rect& rect_in_dip); | 34 const RenderWidgetHostView* view, const gfx::Rect& rect_in_dip); |
31 | 35 |
| 36 // Decides whether to enable/disable double tap zoom for a page. |
| 37 // By default returns |true|, except for the following cases: |
| 38 // - pages that have a width=device-width or narrower viewport |
| 39 // (indicating that this is a mobile-optimized or responsive |
| 40 // web design, so text will be legible without zooming); |
| 41 // - pages that prevent zooming in or out. |
| 42 CONTENT_EXPORT bool IsMobileOptimizedFrame( |
| 43 const cc::CompositorFrameMetadata& frame_metadata); |
| 44 |
32 } // namespace content | 45 } // namespace content |
33 | 46 |
34 #endif // CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_ | 47 #endif // CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_ |
OLD | NEW |