blob: 5303663c107172717f95695116617f660109a87b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_
#define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_
#include "content/browser/devtools/protocol/devtools_protocol_handler.h"
#include "content/browser/devtools/protocol/page_handler.h"
#include "third_party/WebKit/public/web/WebDeviceEmulationParams.h"
namespace content {
class RenderFrameHostImpl;
class WebContentsImpl;
namespace devtools {
namespace page { class PageHandler; }
namespace emulation {
class EmulationHandler : public page::PageHandler::ScreencastListener {
public:
using Response = DevToolsProtocolClient::Response;
explicit EmulationHandler(page::PageHandler* page_handler);
~EmulationHandler() override;
// page::PageHandler::ScreencastListener implementation.
void ScreencastEnabledChanged() override;
void SetRenderFrameHost(RenderFrameHostImpl* host);
void Detached();
Response SetGeolocationOverride(double* latitude,
double* longitude,
double* accuracy);
Response ClearGeolocationOverride();
Response SetTouchEmulationEnabled(bool enabled,
const std::string* configuration);
Response CanEmulate(bool* result);
Response SetDeviceMetricsOverride(int width,
int height,
double device_scale_factor,
bool mobile,
bool fit_window,
const double* optional_scale,
const double* optional_offset_x,
const double* optional_offset_y);
Response ClearDeviceMetricsOverride();
private:
WebContentsImpl* GetWebContents();
void UpdateTouchEventEmulationState();
void UpdateDeviceEmulationState();
bool touch_emulation_enabled_;
std::string touch_emulation_configuration_;
bool device_emulation_enabled_;
blink::WebDeviceEmulationParams device_emulation_params_;
page::PageHandler* page_handler_;
RenderFrameHostImpl* host_;
DISALLOW_COPY_AND_ASSIGN(EmulationHandler);
};
} // namespace emulation
} // namespace devtools
} // namespace content
#endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_
|