OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_H_ |
6 #define CONTENT_RENDERER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 friend class ScreenOrientationDispatcherTest; | 40 friend class ScreenOrientationDispatcherTest; |
41 | 41 |
42 // RenderFrameObserver implementation. | 42 // RenderFrameObserver implementation. |
43 void OnDestruct() override; | 43 void OnDestruct() override; |
44 | 44 |
45 // blink::WebScreenOrientationClient implementation. | 45 // blink::WebScreenOrientationClient implementation. |
46 void lockOrientation( | 46 void lockOrientation( |
47 blink::WebScreenOrientationLockType orientation, | 47 blink::WebScreenOrientationLockType orientation, |
48 std::unique_ptr<blink::WebLockOrientationCallback> callback) override; | 48 std::unique_ptr<blink::WebLockOrientationCallback> callback) override; |
49 void unlockOrientation() override; | 49 void unlockOrientation() override; |
| 50 void startAccurateListen() override; |
| 51 void stopAccurateListen() override; |
50 | 52 |
51 void OnLockOrientationResult(int request_id, | 53 void OnLockOrientationResult(int request_id, |
52 ScreenOrientationLockResult result); | 54 ScreenOrientationLockResult result); |
53 | 55 |
54 void CancelPendingLocks(); | 56 void CancelPendingLocks(); |
55 | 57 |
56 int GetRequestIdForTests(); | 58 int GetRequestIdForTests(); |
57 | 59 |
58 void EnsureScreenOrientationService(); | 60 device::mojom::ScreenOrientation* GetRemoteScreenOrientation(); |
59 | 61 |
60 // This should only be called by ScreenOrientationDispatcherTest | 62 // This should only be called by ScreenOrientationDispatcherTest |
61 void SetScreenOrientationForTests( | 63 void SetScreenOrientationForTests( |
62 ScreenOrientationAssociatedPtr& screen_orientation_for_tests) { | 64 ScreenOrientationAssociatedPtr& screen_orientation_for_tests) { |
63 screen_orientation_ = std::move(screen_orientation_for_tests); | 65 screen_orientation_ = std::move(screen_orientation_for_tests); |
64 } | 66 } |
65 | 67 |
66 // The pending_callbacks_ map is mostly meant to have a unique ID to associate | 68 // The pending_callbacks_ map is mostly meant to have a unique ID to associate |
67 // with every callback going trough the dispatcher. The map will own the | 69 // with every callback going trough the dispatcher. The map will own the |
68 // pointer in the sense that it will destroy it when Remove() will be called. | 70 // pointer in the sense that it will destroy it when Remove() will be called. |
69 // Furthermore, we only expect to have one callback at a time in this map, | 71 // Furthermore, we only expect to have one callback at a time in this map, |
70 // which is what IDMap was designed for. | 72 // which is what IDMap was designed for. |
71 using CallbackMap = IDMap<std::unique_ptr<blink::WebLockOrientationCallback>>; | 73 using CallbackMap = IDMap<std::unique_ptr<blink::WebLockOrientationCallback>>; |
72 CallbackMap pending_callbacks_; | 74 CallbackMap pending_callbacks_; |
73 | 75 |
74 ScreenOrientationAssociatedPtr screen_orientation_; | 76 ScreenOrientationAssociatedPtr screen_orientation_; |
75 | 77 |
76 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationDispatcher); | 78 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationDispatcher); |
77 }; | 79 }; |
78 | 80 |
79 } // namespace content | 81 } // namespace content |
80 | 82 |
81 #endif // CONTENT_RENDERER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_H_ | 83 #endif // CONTENT_RENDERER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_H_ |
OLD | NEW |