| 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 "wtf/Forward.h" | 8 #include "wtf/Forward.h" |
| 9 #include "wtf/OwnPtr.h" | 9 #include "wtf/OwnPtr.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class IntPoint; | 13 class IntPoint; |
| 14 class WebDevToolsAgentImpl; | |
| 15 class WebInputEvent; | 14 class WebInputEvent; |
| 16 class WebViewImpl; | 15 class WebViewImpl; |
| 17 | 16 |
| 18 struct WebDeviceEmulationParams; | 17 struct WebDeviceEmulationParams; |
| 19 | 18 |
| 20 class DevToolsEmulator final { | 19 class DevToolsEmulator final { |
| 21 public: | 20 public: |
| 22 explicit DevToolsEmulator(WebViewImpl*); | 21 explicit DevToolsEmulator(WebViewImpl*); |
| 23 ~DevToolsEmulator(); | 22 ~DevToolsEmulator(); |
| 24 | 23 |
| 25 // FIXME(dgozman): remove this after reversing emulation flow. | |
| 26 void setDevToolsAgent(WebDevToolsAgentImpl*); | |
| 27 | |
| 28 // Settings overrides. | 24 // Settings overrides. |
| 29 void setTextAutosizingEnabled(bool); | 25 void setTextAutosizingEnabled(bool); |
| 30 void setDeviceScaleAdjustment(float); | 26 void setDeviceScaleAdjustment(float); |
| 31 void setPreferCompositingToLCDTextEnabled(bool); | 27 void setPreferCompositingToLCDTextEnabled(bool); |
| 32 void setUseMobileViewportStyle(bool); | 28 void setUseMobileViewportStyle(bool); |
| 33 | 29 |
| 34 // FIXME(dgozman): remove this after reversing emulation flow. | |
| 35 void setDeviceMetricsOverride(int width, int height, float deviceScaleFactor
, bool mobile, bool fitWindow, float scale, float offsetX, float offsetY); | |
| 36 void clearDeviceMetricsOverride(); | |
| 37 | |
| 38 // Emulation. | 30 // Emulation. |
| 39 void enableDeviceEmulation(const WebDeviceEmulationParams&); | 31 void enableDeviceEmulation(const WebDeviceEmulationParams&); |
| 40 void disableDeviceEmulation(); | 32 void disableDeviceEmulation(); |
| 41 bool deviceEmulationEnabled() { return m_deviceMetricsEnabled; } | 33 bool deviceEmulationEnabled() { return m_deviceMetricsEnabled; } |
| 42 void setTouchEventEmulationEnabled(bool); | 34 void setTouchEventEmulationEnabled(bool); |
| 43 bool handleInputEvent(const WebInputEvent&); | 35 bool handleInputEvent(const WebInputEvent&); |
| 44 | 36 |
| 45 private: | 37 private: |
| 46 void enableMobileEmulation(); | 38 void enableMobileEmulation(); |
| 47 void disableMobileEmulation(); | 39 void disableMobileEmulation(); |
| 48 | 40 |
| 49 // FIXME(dgozman): remove this after reversing emulation flow. | |
| 50 void enableDeviceEmulationInner(const WebDeviceEmulationParams&); | |
| 51 void disableDeviceEmulationInner(); | |
| 52 | |
| 53 WebViewImpl* m_webViewImpl; | 41 WebViewImpl* m_webViewImpl; |
| 54 WebDevToolsAgentImpl* m_devToolsAgent; | |
| 55 bool m_deviceMetricsEnabled; | 42 bool m_deviceMetricsEnabled; |
| 56 bool m_emulateMobileEnabled; | 43 bool m_emulateMobileEnabled; |
| 57 bool m_originalViewportEnabled; | 44 bool m_originalViewportEnabled; |
| 58 bool m_isOverlayScrollbarsEnabled; | 45 bool m_isOverlayScrollbarsEnabled; |
| 59 float m_originalDefaultMinimumPageScaleFactor; | 46 float m_originalDefaultMinimumPageScaleFactor; |
| 60 float m_originalDefaultMaximumPageScaleFactor; | 47 float m_originalDefaultMaximumPageScaleFactor; |
| 61 bool m_embedderTextAutosizingEnabled; | 48 bool m_embedderTextAutosizingEnabled; |
| 62 float m_embedderDeviceScaleAdjustment; | 49 float m_embedderDeviceScaleAdjustment; |
| 63 bool m_embedderPreferCompositingToLCDTextEnabled; | 50 bool m_embedderPreferCompositingToLCDTextEnabled; |
| 64 bool m_embedderUseMobileViewport; | 51 bool m_embedderUseMobileViewport; |
| 65 | 52 |
| 66 bool m_touchEventEmulationEnabled; | 53 bool m_touchEventEmulationEnabled; |
| 67 bool m_originalTouchEnabled; | 54 bool m_originalTouchEnabled; |
| 68 bool m_originalDeviceSupportsMouse; | 55 bool m_originalDeviceSupportsMouse; |
| 69 bool m_originalDeviceSupportsTouch; | 56 bool m_originalDeviceSupportsTouch; |
| 70 int m_originalMaxTouchPoints; | 57 int m_originalMaxTouchPoints; |
| 71 OwnPtr<IntPoint> m_lastPinchAnchorCss; | 58 OwnPtr<IntPoint> m_lastPinchAnchorCss; |
| 72 OwnPtr<IntPoint> m_lastPinchAnchorDip; | 59 OwnPtr<IntPoint> m_lastPinchAnchorDip; |
| 73 | |
| 74 // FIXME(dgozman): remove this after reversing emulation flow. | |
| 75 bool m_ignoreSetOverrides; | |
| 76 }; | 60 }; |
| 77 | 61 |
| 78 } // namespace blink | 62 } // namespace blink |
| 79 | 63 |
| 80 #endif | 64 #endif |
| OLD | NEW |