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_dispatcher.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 const int* screen_widget
,
54 const int* screen_height
,
55 const int* position_x
,
56 const int* position_y
);
57 Response
ClearDeviceMetricsOverride();
60 WebContentsImpl
* GetWebContents();
61 void UpdateTouchEventEmulationState();
62 void UpdateDeviceEmulationState();
64 bool touch_emulation_enabled_
;
65 std::string touch_emulation_configuration_
;
67 bool device_emulation_enabled_
;
68 blink::WebDeviceEmulationParams device_emulation_params_
;
70 page::PageHandler
* page_handler_
;
71 RenderFrameHostImpl
* host_
;
73 DISALLOW_COPY_AND_ASSIGN(EmulationHandler
);
76 } // namespace emulation
77 } // namespace devtools
78 } // namespace content
80 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_