| 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 "third_party/WebKit/public/platform/WebScreenOrientationLockType.h" | 11 #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h" |
| 12 #include "third_party/WebKit/public/platform/WebScreenOrientationType.h" | 12 #include "third_party/WebKit/public/platform/WebScreenOrientationType.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 class WebScreenOrientationListener; | 15 class WebScreenOrientationListener; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 class RenderView; |
| 19 | 20 |
| 20 class MockScreenOrientationController | 21 class MockScreenOrientationController |
| 21 : public base::RefCountedThreadSafe<MockScreenOrientationController> { | 22 : public base::RefCountedThreadSafe<MockScreenOrientationController> { |
| 22 public: | 23 public: |
| 23 MockScreenOrientationController(); | 24 MockScreenOrientationController(); |
| 24 | 25 |
| 25 void SetListener(blink::WebScreenOrientationListener* listener); | 26 void SetListener(blink::WebScreenOrientationListener* listener); |
| 26 void ResetData(); | 27 void ResetData(); |
| 27 void UpdateLock(blink::WebScreenOrientationLockType); | 28 void UpdateLock(blink::WebScreenOrientationLockType); |
| 28 void ResetLock(); | 29 void ResetLock(); |
| 29 void UpdateDeviceOrientation(blink::WebScreenOrientationType); | 30 void UpdateDeviceOrientation( |
| 31 RenderView* render_view, |
| 32 blink::WebScreenOrientationType); |
| 33 void ResetRenderView(); |
| 30 | 34 |
| 31 private: | 35 private: |
| 32 virtual ~MockScreenOrientationController(); | 36 virtual ~MockScreenOrientationController(); |
| 33 | 37 |
| 34 void UpdateLockSync(blink::WebScreenOrientationLockType); | 38 void UpdateLockSync(blink::WebScreenOrientationLockType); |
| 35 void ResetLockSync(); | 39 void ResetLockSync(); |
| 36 void UpdateScreenOrientation(blink::WebScreenOrientationType); | 40 void UpdateScreenOrientation(blink::WebScreenOrientationType); |
| 37 bool IsOrientationAllowedByCurrentLock(blink::WebScreenOrientationType); | 41 bool IsOrientationAllowedByCurrentLock(blink::WebScreenOrientationType); |
| 38 blink::WebScreenOrientationType SuitableOrientationForCurrentLock(); | 42 blink::WebScreenOrientationType SuitableOrientationForCurrentLock(); |
| 39 | 43 |
| 40 blink::WebScreenOrientationLockType current_lock_; | 44 blink::WebScreenOrientationLockType current_lock_; |
| 41 blink::WebScreenOrientationType device_orientation_; | 45 blink::WebScreenOrientationType device_orientation_; |
| 42 blink::WebScreenOrientationType current_orientation_; | 46 blink::WebScreenOrientationType current_orientation_; |
| 43 blink::WebScreenOrientationListener* listener_; | 47 blink::WebScreenOrientationListener* listener_; |
| 48 RenderView* render_view_; |
| 44 | 49 |
| 45 DISALLOW_COPY_AND_ASSIGN(MockScreenOrientationController); | 50 DISALLOW_COPY_AND_ASSIGN(MockScreenOrientationController); |
| 46 friend class base::LazyInstance<MockScreenOrientationController>; | 51 friend class base::LazyInstance<MockScreenOrientationController>; |
| 47 friend class base::RefCountedThreadSafe<MockScreenOrientationController>; | 52 friend class base::RefCountedThreadSafe<MockScreenOrientationController>; |
| 48 }; | 53 }; |
| 49 | 54 |
| 50 } // namespace content | 55 } // namespace content |
| 51 | 56 |
| 52 #endif // CONTENT_RENDERER_SCREEN_ORIENTATION_MOCK_SCREEN_ORIENTATION_CONTROLLER
_H_ | 57 #endif // CONTENT_RENDERER_SCREEN_ORIENTATION_MOCK_SCREEN_ORIENTATION_CONTROLLER
_H_ |
| OLD | NEW |