• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef CONTENT_RENDERER_SCREEN_ORIENTATION_MOCK_SCREEN_ORIENTATION_CONTROLLER_H_
6 #define CONTENT_RENDERER_SCREEN_ORIENTATION_MOCK_SCREEN_ORIENTATION_CONTROLLER_H_
7 
8 #include "base/lazy_instance.h"
9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h"
11 #include "content/public/renderer/render_view_observer.h"
12 #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h"
13 #include "third_party/WebKit/public/platform/WebScreenOrientationType.h"
14 
15 namespace content {
16 class RenderView;
17 class RenderViewImpl;
18 
19 class MockScreenOrientationController
20     : public base::RefCountedThreadSafe<MockScreenOrientationController>,
21       public RenderViewObserver {
22  public:
23   MockScreenOrientationController();
24 
25   void ResetData();
26   void UpdateDeviceOrientation(RenderView* render_view,
27                                blink::WebScreenOrientationType);
28 
29  private:
30   virtual ~MockScreenOrientationController();
31 
32   void UpdateScreenOrientation(blink::WebScreenOrientationType);
33   bool IsOrientationAllowedByCurrentLock(blink::WebScreenOrientationType);
34   RenderViewImpl* render_view_impl() const;
35 
36   // RenderViewObserver
37   virtual void OnDestruct() OVERRIDE;
38 
39   blink::WebScreenOrientationLockType current_lock_;
40   blink::WebScreenOrientationType device_orientation_;
41   blink::WebScreenOrientationType current_orientation_;
42 
43   DISALLOW_COPY_AND_ASSIGN(MockScreenOrientationController);
44   friend class base::LazyInstance<MockScreenOrientationController>;
45   friend class base::RefCountedThreadSafe<MockScreenOrientationController>;
46 };
47 
48 } // namespace content
49 
50 #endif // CONTENT_RENDERER_SCREEN_ORIENTATION_MOCK_SCREEN_ORIENTATION_CONTROLLER_H_
51