[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / browser / devtools / protocol / emulation_handler.h
blobc2a4bd38fbd80e400279a0054139078255441638
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"
12 namespace content {
14 class RenderFrameHostImpl;
15 class WebContentsImpl;
17 namespace devtools {
19 namespace page { class PageHandler; }
21 namespace emulation {
23 class EmulationHandler : public page::PageHandler::ScreencastListener {
24 public:
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);
34 void Detached();
36 Response SetGeolocationOverride(double* latitude,
37 double* longitude,
38 double* accuracy);
39 Response ClearGeolocationOverride();
41 Response SetTouchEmulationEnabled(bool enabled,
42 const std::string* configuration);
44 Response CanEmulate(bool* result);
45 Response SetDeviceMetricsOverride(int width,
46 int height,
47 double device_scale_factor,
48 bool mobile,
49 bool fit_window,
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();
59 private:
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_