OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 DevToolsEmulator_h | 5 #ifndef DevToolsEmulator_h |
6 #define DevToolsEmulator_h | 6 #define DevToolsEmulator_h |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 #include "platform/wtf/Forward.h" | 10 #include "platform/wtf/Forward.h" |
11 #include "platform/wtf/Optional.h" | 11 #include "platform/wtf/Optional.h" |
12 #include "public/platform/PointerProperties.h" | 12 #include "public/platform/PointerProperties.h" |
13 #include "public/platform/WebFloatPoint.h" | 13 #include "public/platform/WebFloatPoint.h" |
14 #include "public/platform/WebViewportStyle.h" | 14 #include "public/platform/WebViewportStyle.h" |
15 #include "public/web/WebDeviceEmulationParams.h" | 15 #include "public/web/WebDeviceEmulationParams.h" |
16 #include "web/WebExport.h" | 16 #include "web/WebExport.h" |
17 | 17 |
18 namespace blink { | 18 namespace blink { |
19 | 19 |
20 class IntPoint; | 20 class IntPoint; |
21 class IntRect; | 21 class IntRect; |
22 class TransformationMatrix; | 22 class TransformationMatrix; |
23 class WebInputEvent; | 23 class WebInputEvent; |
24 class WebViewImpl; | 24 class WebViewBase; |
25 | 25 |
26 class WEB_EXPORT DevToolsEmulator final | 26 class WEB_EXPORT DevToolsEmulator final |
27 : public GarbageCollectedFinalized<DevToolsEmulator> { | 27 : public GarbageCollectedFinalized<DevToolsEmulator> { |
28 public: | 28 public: |
29 ~DevToolsEmulator(); | 29 ~DevToolsEmulator(); |
30 static DevToolsEmulator* Create(WebViewImpl*); | 30 static DevToolsEmulator* Create(WebViewBase*); |
31 DECLARE_TRACE(); | 31 DECLARE_TRACE(); |
32 | 32 |
33 // Settings overrides. | 33 // Settings overrides. |
34 void SetTextAutosizingEnabled(bool); | 34 void SetTextAutosizingEnabled(bool); |
35 void SetDeviceScaleAdjustment(float); | 35 void SetDeviceScaleAdjustment(float); |
36 void SetPreferCompositingToLCDTextEnabled(bool); | 36 void SetPreferCompositingToLCDTextEnabled(bool); |
37 void SetViewportStyle(WebViewportStyle); | 37 void SetViewportStyle(WebViewportStyle); |
38 void SetPluginsEnabled(bool); | 38 void SetPluginsEnabled(bool); |
39 void SetScriptEnabled(bool); | 39 void SetScriptEnabled(bool); |
40 void SetDoubleTapToZoomEnabled(bool); | 40 void SetDoubleTapToZoomEnabled(bool); |
(...skipping 17 matching lines...) Expand all Loading... |
58 | 58 |
59 // Notify the DevToolsEmulator about a scroll or scale change of the main | 59 // Notify the DevToolsEmulator about a scroll or scale change of the main |
60 // frame. Updates the transform for a viewport override. | 60 // frame. Updates the transform for a viewport override. |
61 void MainFrameScrollOrScaleChanged(); | 61 void MainFrameScrollOrScaleChanged(); |
62 | 62 |
63 // Returns a custom visible content rect if a viewport override is active. | 63 // Returns a custom visible content rect if a viewport override is active. |
64 // This ensures that all content inside the forced viewport is painted. | 64 // This ensures that all content inside the forced viewport is painted. |
65 WTF::Optional<IntRect> VisibleContentRectForPainting() const; | 65 WTF::Optional<IntRect> VisibleContentRectForPainting() const; |
66 | 66 |
67 private: | 67 private: |
68 explicit DevToolsEmulator(WebViewImpl*); | 68 explicit DevToolsEmulator(WebViewBase*); |
69 | 69 |
70 void EnableMobileEmulation(); | 70 void EnableMobileEmulation(); |
71 void DisableMobileEmulation(); | 71 void DisableMobileEmulation(); |
72 | 72 |
73 // Returns the original device scale factor when overridden by DevTools, or | 73 // Returns the original device scale factor when overridden by DevTools, or |
74 // deviceScaleFactor() otherwise. | 74 // deviceScaleFactor() otherwise. |
75 float CompositorDeviceScaleFactor() const; | 75 float CompositorDeviceScaleFactor() const; |
76 | 76 |
77 void ApplyDeviceEmulationTransform(TransformationMatrix*); | 77 void ApplyDeviceEmulationTransform(TransformationMatrix*); |
78 void ApplyViewportOverride(TransformationMatrix*); | 78 void ApplyViewportOverride(TransformationMatrix*); |
79 void UpdateRootLayerTransform(); | 79 void UpdateRootLayerTransform(); |
80 | 80 |
81 WebViewImpl* web_view_impl_; | 81 WebViewBase* web_view_impl_; |
82 | 82 |
83 bool device_metrics_enabled_; | 83 bool device_metrics_enabled_; |
84 bool emulate_mobile_enabled_; | 84 bool emulate_mobile_enabled_; |
85 WebDeviceEmulationParams emulation_params_; | 85 WebDeviceEmulationParams emulation_params_; |
86 | 86 |
87 struct ViewportOverride { | 87 struct ViewportOverride { |
88 WebFloatPoint position; | 88 WebFloatPoint position; |
89 double scale; | 89 double scale; |
90 bool original_visual_viewport_masking; | 90 bool original_visual_viewport_masking; |
91 }; | 91 }; |
(...skipping 23 matching lines...) Expand all Loading... |
115 std::unique_ptr<IntPoint> last_pinch_anchor_css_; | 115 std::unique_ptr<IntPoint> last_pinch_anchor_css_; |
116 std::unique_ptr<IntPoint> last_pinch_anchor_dip_; | 116 std::unique_ptr<IntPoint> last_pinch_anchor_dip_; |
117 | 117 |
118 bool embedder_script_enabled_; | 118 bool embedder_script_enabled_; |
119 bool script_execution_disabled_; | 119 bool script_execution_disabled_; |
120 }; | 120 }; |
121 | 121 |
122 } // namespace blink | 122 } // namespace blink |
123 | 123 |
124 #endif | 124 #endif |
OLD | NEW |