OLD | NEW |
| (Empty) |
1 // Copyright 2014 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. | |
4 | |
5 #include "content/public/renderer/platform_event_observer.h" | |
6 #include "device/screen_orientation/public/interfaces/screen_orientation.mojom.h
" | |
7 | |
8 namespace content { | |
9 | |
10 // ScreenOrientationObserver is a helper class implementing the | |
11 // PlatformEventObserver template with blink::WebPlatformEventListener, which is | |
12 // a pure virtual class because it doesn't expect listeners. | |
13 // It is implemented on top of PlatformEventObserver to make sure it follows a | |
14 // common code path even though it only uses part of this code path: it is not | |
15 // expected to receive messages back but should send messages to start/stop | |
16 // listening. | |
17 // The intent of this class is to make sure that platforms that can't listen for | |
18 // display rotations at a marginal cost can be told when to actually do it. | |
19 class ScreenOrientationObserver | |
20 : public PlatformEventObserver<blink::WebPlatformEventListener> { | |
21 public: | |
22 ScreenOrientationObserver(); | |
23 ~ScreenOrientationObserver() override; | |
24 | |
25 // Overriding this method just to make sure |listener| is always null. | |
26 void Start(blink::WebPlatformEventListener* listener) override; | |
27 | |
28 protected: | |
29 void SendStartMessage() override; | |
30 void SendStopMessage() override; | |
31 | |
32 private: | |
33 device::mojom::ScreenOrientationListener* GetScreenOrientationListener(); | |
34 | |
35 device::mojom::ScreenOrientationListenerAssociatedPtr listener_; | |
36 }; | |
37 | |
38 }; // namespace content | |
OLD | NEW |