Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: content/renderer/screen_orientation/mock_screen_orientation_controller.h

Issue 302553007: Call RenderViewImpl::SetScreenOrientationForTesting to make sure that events are not sent when orie… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated by review comments. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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);
30 33
31 private: 34 private:
32 virtual ~MockScreenOrientationController(); 35 virtual ~MockScreenOrientationController();
33 36
34 void UpdateLockSync(blink::WebScreenOrientationLockType); 37 void UpdateLockSync(blink::WebScreenOrientationLockType);
35 void ResetLockSync(); 38 void ResetLockSync();
36 void UpdateScreenOrientation(blink::WebScreenOrientationType); 39 void UpdateScreenOrientation(blink::WebScreenOrientationType);
37 bool IsOrientationAllowedByCurrentLock(blink::WebScreenOrientationType); 40 bool IsOrientationAllowedByCurrentLock(blink::WebScreenOrientationType);
38 blink::WebScreenOrientationType SuitableOrientationForCurrentLock(); 41 blink::WebScreenOrientationType SuitableOrientationForCurrentLock();
39 42
40 blink::WebScreenOrientationLockType current_lock_; 43 blink::WebScreenOrientationLockType current_lock_;
41 blink::WebScreenOrientationType device_orientation_; 44 blink::WebScreenOrientationType device_orientation_;
42 blink::WebScreenOrientationType current_orientation_; 45 blink::WebScreenOrientationType current_orientation_;
43 blink::WebScreenOrientationListener* listener_; 46 blink::WebScreenOrientationListener* listener_;
47 RenderView* render_view_;
44 48
45 DISALLOW_COPY_AND_ASSIGN(MockScreenOrientationController); 49 DISALLOW_COPY_AND_ASSIGN(MockScreenOrientationController);
46 friend class base::LazyInstance<MockScreenOrientationController>; 50 friend class base::LazyInstance<MockScreenOrientationController>;
47 friend class base::RefCountedThreadSafe<MockScreenOrientationController>; 51 friend class base::RefCountedThreadSafe<MockScreenOrientationController>;
48 }; 52 };
49 53
50 } // namespace content 54 } // namespace content
51 55
52 #endif // CONTENT_RENDERER_SCREEN_ORIENTATION_MOCK_SCREEN_ORIENTATION_CONTROLLER _H_ 56 #endif // CONTENT_RENDERER_SCREEN_ORIENTATION_MOCK_SCREEN_ORIENTATION_CONTROLLER _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698