Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / web / DevToolsEmulator.h
blob9dd983c4c08227a0d909437a7626cd71ff3efe19
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
3 // found in the LICENSE file.
5 #ifndef DevToolsEmulator_h
6 #define DevToolsEmulator_h
8 #include "core/css/PointerProperties.h"
9 #include "platform/heap/Handle.h"
10 #include "wtf/Forward.h"
11 #include "wtf/OwnPtr.h"
13 namespace blink {
15 class InspectorEmulationAgent;
16 class IntPoint;
17 class WebInputEvent;
18 class WebViewImpl;
20 struct WebDeviceEmulationParams;
22 class DevToolsEmulator final : public NoBaseWillBeGarbageCollectedFinalized<DevToolsEmulator> {
23 public:
24 ~DevToolsEmulator();
25 static PassOwnPtrWillBeRawPtr<DevToolsEmulator> create(WebViewImpl*);
26 DECLARE_TRACE();
28 void setEmulationAgent(InspectorEmulationAgent*);
29 void viewportChanged();
31 // Settings overrides.
32 void setTextAutosizingEnabled(bool);
33 void setDeviceScaleAdjustment(float);
34 void setPreferCompositingToLCDTextEnabled(bool);
35 void setUseMobileViewportStyle(bool);
36 void setPluginsEnabled(bool);
37 void setScriptEnabled(bool);
38 void setDoubleTapToZoomEnabled(bool);
39 bool doubleTapToZoomEnabled() const;
40 void setHidePinchScrollbarsNearMinScale(bool);
41 void setAvailablePointerTypes(int);
42 void setPrimaryPointerType(PointerType);
43 void setAvailableHoverTypes(int);
44 void setPrimaryHoverType(HoverType);
46 // Emulation.
47 void enableDeviceEmulation(const WebDeviceEmulationParams&);
48 void disableDeviceEmulation();
49 bool deviceEmulationEnabled() { return m_deviceMetricsEnabled; }
50 void setTouchEventEmulationEnabled(bool);
51 bool handleInputEvent(const WebInputEvent&);
52 void setScriptExecutionDisabled(bool);
54 private:
55 explicit DevToolsEmulator(WebViewImpl*);
57 void enableMobileEmulation();
58 void disableMobileEmulation();
60 WebViewImpl* m_webViewImpl;
61 RawPtrWillBeMember<InspectorEmulationAgent> m_emulationAgent;
63 bool m_deviceMetricsEnabled;
64 bool m_emulateMobileEnabled;
65 bool m_isOverlayScrollbarsEnabled;
66 float m_originalDefaultMinimumPageScaleFactor;
67 float m_originalDefaultMaximumPageScaleFactor;
68 bool m_embedderTextAutosizingEnabled;
69 float m_embedderDeviceScaleAdjustment;
70 bool m_embedderPreferCompositingToLCDTextEnabled;
71 bool m_embedderUseMobileViewport;
72 bool m_embedderPluginsEnabled;
73 int m_embedderAvailablePointerTypes;
74 PointerType m_embedderPrimaryPointerType;
75 int m_embedderAvailableHoverTypes;
76 HoverType m_embedderPrimaryHoverType;
78 bool m_touchEventEmulationEnabled;
79 bool m_doubleTapToZoomEnabled;
80 bool m_originalTouchEnabled;
81 bool m_originalDeviceSupportsMouse;
82 bool m_originalDeviceSupportsTouch;
83 int m_originalMaxTouchPoints;
84 OwnPtr<IntPoint> m_lastPinchAnchorCss;
85 OwnPtr<IntPoint> m_lastPinchAnchorDip;
87 bool m_embedderScriptEnabled;
88 bool m_scriptExecutionDisabled;
89 bool m_hidePinchScrollbarsNearMinScale;
92 } // namespace blink
94 #endif