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
content / browser / devtools / protocol / device_orientation_handler.h [blame]
// Copyright 2024 The Chromium Authors
// 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_DEVICE_ORIENTATION_HANDLER_H_
#define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVICE_ORIENTATION_HANDLER_H_
#include <memory>
#include "base/memory/raw_ptr.h"
#include "content/browser/devtools/protocol/device_orientation.h"
#include "content/browser/devtools/protocol/devtools_domain_handler.h"
namespace content {
class RenderFrameHostImpl;
class ScopedVirtualSensorForDevTools;
class WebContentsImpl;
namespace protocol {
// Handling of this CDP domain is also partially implemented in Blink. See
// DeviceOrientationInspectorAgent.
class DeviceOrientationHandler : public DevToolsDomainHandler,
public DeviceOrientation::Backend {
public:
DeviceOrientationHandler();
DeviceOrientationHandler(const DeviceOrientationHandler&) = delete;
DeviceOrientationHandler& operator=(const DeviceOrientationHandler&) = delete;
~DeviceOrientationHandler() override;
private:
WebContentsImpl* GetWebContents();
// DevToolsDomainHandler overrides.
void Wire(UberDispatcher* dispatcher) override;
void SetRenderer(int process_host_id,
RenderFrameHostImpl* frame_host) override;
Response Disable() override;
// DeviceOrientation::Backend overrides.
Response ClearDeviceOrientationOverride() override;
void SetDeviceOrientationOverride(
double alpha,
double beta,
double gamma,
std::unique_ptr<SetDeviceOrientationOverrideCallback> callback) override;
// This is safe to store because it is updated by SetRenderer(). It is
// guaranteed that SetRenderer() is called before a RFH is deleted.
// See bug 323904196.
raw_ptr<RenderFrameHostImpl> frame_host_ = nullptr;
std::unique_ptr<ScopedVirtualSensorForDevTools> virtual_sensor_;
};
} // namespace protocol
} // namespace content
#endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVICE_ORIENTATION_HANDLER_H_