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_MOCK_SCREEN_ORIENTATION_CONTROLLER_H
_ | 5 #ifndef CONTENT_RENDERER_SCREEN_ORIENTATION_MOCK_SCREEN_ORIENTATION_CONTROLLER_H
_ |
6 #define CONTENT_RENDERER_SCREEN_ORIENTATION_MOCK_SCREEN_ORIENTATION_CONTROLLER_H
_ | 6 #define CONTENT_RENDERER_SCREEN_ORIENTATION_MOCK_SCREEN_ORIENTATION_CONTROLLER_H
_ |
7 | 7 |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "content/public/renderer/render_view_observer.h" |
11 #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h" | 12 #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h" |
12 #include "third_party/WebKit/public/platform/WebScreenOrientationType.h" | 13 #include "third_party/WebKit/public/platform/WebScreenOrientationType.h" |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 class WebScreenOrientationListener; | 16 class WebScreenOrientationListener; |
16 } | 17 } |
17 | 18 |
18 namespace content { | 19 namespace content { |
| 20 class RenderView; |
| 21 class RenderViewImpl; |
19 | 22 |
20 class MockScreenOrientationController | 23 class MockScreenOrientationController |
21 : public base::RefCountedThreadSafe<MockScreenOrientationController> { | 24 : public base::RefCountedThreadSafe<MockScreenOrientationController>, |
| 25 public RenderViewObserver { |
22 public: | 26 public: |
23 MockScreenOrientationController(); | 27 MockScreenOrientationController(); |
24 | 28 |
25 void SetListener(blink::WebScreenOrientationListener* listener); | 29 void SetListener(blink::WebScreenOrientationListener* listener); |
26 void ResetData(); | 30 void ResetData(); |
27 void UpdateLock(blink::WebScreenOrientationLockType); | 31 void UpdateLock(blink::WebScreenOrientationLockType); |
28 void ResetLock(); | 32 void ResetLock(); |
29 void UpdateDeviceOrientation(blink::WebScreenOrientationType); | 33 void UpdateDeviceOrientation( |
| 34 RenderView* render_view, |
| 35 blink::WebScreenOrientationType); |
30 | 36 |
31 private: | 37 private: |
32 virtual ~MockScreenOrientationController(); | 38 virtual ~MockScreenOrientationController(); |
33 | 39 |
34 void UpdateLockSync(blink::WebScreenOrientationLockType); | 40 void UpdateLockSync(blink::WebScreenOrientationLockType); |
35 void ResetLockSync(); | 41 void ResetLockSync(); |
36 void UpdateScreenOrientation(blink::WebScreenOrientationType); | 42 void UpdateScreenOrientation(blink::WebScreenOrientationType); |
37 bool IsOrientationAllowedByCurrentLock(blink::WebScreenOrientationType); | 43 bool IsOrientationAllowedByCurrentLock(blink::WebScreenOrientationType); |
38 blink::WebScreenOrientationType SuitableOrientationForCurrentLock(); | 44 blink::WebScreenOrientationType SuitableOrientationForCurrentLock(); |
| 45 RenderViewImpl* render_view_impl() const; |
| 46 |
| 47 // RenderViewObserver |
| 48 virtual void OnDestruct() OVERRIDE; |
39 | 49 |
40 blink::WebScreenOrientationLockType current_lock_; | 50 blink::WebScreenOrientationLockType current_lock_; |
41 blink::WebScreenOrientationType device_orientation_; | 51 blink::WebScreenOrientationType device_orientation_; |
42 blink::WebScreenOrientationType current_orientation_; | 52 blink::WebScreenOrientationType current_orientation_; |
43 blink::WebScreenOrientationListener* listener_; | 53 blink::WebScreenOrientationListener* listener_; |
44 | 54 |
45 DISALLOW_COPY_AND_ASSIGN(MockScreenOrientationController); | 55 DISALLOW_COPY_AND_ASSIGN(MockScreenOrientationController); |
46 friend class base::LazyInstance<MockScreenOrientationController>; | 56 friend class base::LazyInstance<MockScreenOrientationController>; |
47 friend class base::RefCountedThreadSafe<MockScreenOrientationController>; | 57 friend class base::RefCountedThreadSafe<MockScreenOrientationController>; |
48 }; | 58 }; |
49 | 59 |
50 } // namespace content | 60 } // namespace content |
51 | 61 |
52 #endif // CONTENT_RENDERER_SCREEN_ORIENTATION_MOCK_SCREEN_ORIENTATION_CONTROLLER
_H_ | 62 #endif // CONTENT_RENDERER_SCREEN_ORIENTATION_MOCK_SCREEN_ORIENTATION_CONTROLLER
_H_ |
OLD | NEW |