OLD | NEW |
| (Empty) |
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 ASH_CONTENT_DISPLAY_SCREEN_ORIENTATION_DELEGATE_CHROMEOS_H_ | |
6 #define ASH_CONTENT_DISPLAY_SCREEN_ORIENTATION_DELEGATE_CHROMEOS_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "content/public/browser/screen_orientation_delegate.h" | |
10 #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h" | |
11 | |
12 namespace aura { | |
13 class Window; | |
14 } | |
15 | |
16 namespace content { | |
17 class WebContents; | |
18 } | |
19 | |
20 namespace ash { | |
21 | |
22 // Implements ChromeOS specific functionality for ScreenOrientationProvider. | |
23 class ScreenOrientationDelegate : public content::ScreenOrientationDelegate { | |
24 public: | |
25 ScreenOrientationDelegate(); | |
26 virtual ~ScreenOrientationDelegate(); | |
27 | |
28 // content::ScreenOrientationDelegate: | |
29 bool FullScreenRequired(content::WebContents* web_contents) override; | |
30 void Lock(content::WebContents* web_contents, | |
31 blink::WebScreenOrientationLockType lock_orientation) override; | |
32 bool ScreenOrientationProviderSupported() override; | |
33 void Unlock(content::WebContents* web_contents) override; | |
34 | |
35 private: | |
36 // Locks rotation to the angle matching the primary orientation for | |
37 // |lock_orientation|. | |
38 void LockRotationToPrimaryOrientation( | |
39 blink::WebScreenOrientationLockType lock_orientation); | |
40 | |
41 // Locks rotation to the angle matching the secondary orientation for | |
42 // |lock_orientation|. | |
43 void LockRotationToSecondaryOrientation( | |
44 blink::WebScreenOrientationLockType lock_orientation); | |
45 | |
46 // For orientations that do not specify primary or secondary, locks to the | |
47 // current rotation if it matches |lock_orientation|. Otherwise locks to a | |
48 // matching rotation. | |
49 void LockToRotationMatchingOrientation( | |
50 blink::WebScreenOrientationLockType lock_orientation); | |
51 | |
52 // The window that has applied the current lock. No other window can apply a | |
53 // lock until the current window unlocks rotation. | |
54 aura::Window* locking_window_; | |
55 | |
56 // The orientation of the display when at a rotation of 0. | |
57 blink::WebScreenOrientationLockType natural_orientation_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationDelegate); | |
60 }; | |
61 | |
62 } // namespace ash | |
63 | |
64 #endif // ASH_CONTENT_DISPLAY_SCREEN_ORIENTATION_DELEGATE_CHROMEOS_H_ | |
OLD | NEW |