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 CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_
8 #include "content/browser/devtools/protocol/devtools_protocol_handler.h"
9 #include "content/browser/devtools/protocol/page_handler.h"
10 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h"
14 class RenderFrameHostImpl
;
15 class WebContentsImpl
;
19 namespace page
{ class PageHandler
; }
23 class EmulationHandler
: public page::PageHandler::ScreencastListener
{
25 using Response
= DevToolsProtocolClient::Response
;
27 explicit EmulationHandler(page::PageHandler
* page_handler
);
28 ~EmulationHandler() override
;
30 // page::PageHandler::ScreencastListener implementation.
31 void ScreencastEnabledChanged() override
;
33 void SetRenderFrameHost(RenderFrameHostImpl
* host
);
36 Response
SetGeolocationOverride(double* latitude
,
39 Response
ClearGeolocationOverride();
41 Response
SetTouchEmulationEnabled(bool enabled
,
42 const std::string
* configuration
);
44 Response
CanEmulate(bool* result
);
45 Response
SetDeviceMetricsOverride(int width
,
47 double device_scale_factor
,
50 const double* optional_scale
,
51 const double* optional_offset_x
,
52 const double* optional_offset_y
);
53 Response
ClearDeviceMetricsOverride();
56 WebContentsImpl
* GetWebContents();
57 void UpdateTouchEventEmulationState();
58 void UpdateDeviceEmulationState();
60 bool touch_emulation_enabled_
;
61 std::string touch_emulation_configuration_
;
63 bool device_emulation_enabled_
;
64 blink::WebDeviceEmulationParams device_emulation_params_
;
66 page::PageHandler
* page_handler_
;
67 RenderFrameHostImpl
* host_
;
69 DISALLOW_COPY_AND_ASSIGN(EmulationHandler
);
72 } // namespace emulation
73 } // namespace devtools
74 } // namespace content
76 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_