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

Side by Side Diff: ash/content/display/screen_orientation_delegate_chromeos.h

Issue 759063002: Move Screen Rotation from MaximizeModeController to ScreenOrientationController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 ASH_CONTENT_DISPLAY_SCREEN_ORIENTATION_DELEGATE_CHROMEOS_H_ 5 #ifndef ASH_CONTENT_DISPLAY_SCREEN_ORIENTATION_DELEGATE_CHROMEOS_H_
6 #define ASH_CONTENT_DISPLAY_SCREEN_ORIENTATION_DELEGATE_CHROMEOS_H_ 6 #define ASH_CONTENT_DISPLAY_SCREEN_ORIENTATION_DELEGATE_CHROMEOS_H_
7 7
8 #include "ash/ash_export.h"
8 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/observer_list.h"
9 #include "content/public/browser/screen_orientation_delegate.h" 11 #include "content/public/browser/screen_orientation_delegate.h"
10 #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h" 12 #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h"
13 #include "ui/gfx/display.h"
11 14
12 namespace aura { 15 namespace aura {
13 class Window; 16 class Window;
14 } 17 }
15 18
16 namespace content { 19 namespace content {
17 class WebContents; 20 class WebContents;
18 } 21 }
19 22
20 namespace ash { 23 namespace ash {
21 24
22 // Implements ChromeOS specific functionality for ScreenOrientationProvider. 25 // Implements ChromeOS specific functionality for ScreenOrientationProvider.
23 class ScreenOrientationDelegate : public content::ScreenOrientationDelegate { 26 class ASH_EXPORT ScreenOrientationDelegate
27 : public content::ScreenOrientationDelegate {
24 public: 28 public:
29 // Observer that reports changes to the state of ScreenOrientationProvider's
30 // rotation lock.
31 class Observer {
32 public:
33 // Invoked whenever |rotation_locked_| is changed.
flackr 2014/11/27 15:39:15 Since |rotation_locked_| isn't a member of the obs
jonross 2014/12/10 17:57:30 Done.
34 virtual void OnRotationLockChanged(bool rotation_locked) {}
35
36 protected:
37 virtual ~Observer() {}
38 };
39
25 ScreenOrientationDelegate(); 40 ScreenOrientationDelegate();
26 virtual ~ScreenOrientationDelegate(); 41 virtual ~ScreenOrientationDelegate();
27 42
43 // Add/Remove observers.
44 void AddObserver(Observer* observer);
45 void RemoveObserver(Observer* observer);
46
47 bool ignore_display_configuration_updates() const {
48 return ignore_display_configuration_updates_;
49 }
50
51 // True if |rotation_lock_| has been set and accelerometer updates should not
52 // rotate the display.
53 bool rotation_locked() { return rotation_locked_; }
54
55 // If |rotation_locked| future accelerometer updates should not change the
56 // display rotation.
57 void SetRotationLocked(bool rotation_locked);
58
59 // Sets the display rotation and suppresses display notifications.
60 void SetDisplayRotation(gfx::Display::Rotation rotation);
61
28 // content::ScreenOrientationDelegate: 62 // content::ScreenOrientationDelegate:
29 bool FullScreenRequired(content::WebContents* web_contents) override; 63 bool FullScreenRequired(content::WebContents* web_contents) override;
30 void Lock(content::WebContents* web_contents, 64 void Lock(content::WebContents* web_contents,
31 blink::WebScreenOrientationLockType lock_orientation) override; 65 blink::WebScreenOrientationLockType lock_orientation) override;
32 bool ScreenOrientationProviderSupported() override; 66 bool ScreenOrientationProviderSupported() override;
33 void Unlock(content::WebContents* web_contents) override; 67 void Unlock(content::WebContents* web_contents) override;
34 68
35 private: 69 private:
70 // Sets the display rotation to |rotation|. Future calls to
71 // OnAccelerometerUpdated should not be used to change the rotation.
flackr 2014/11/27 15:39:15 Can you update this comment? OnAccelerometerUpdate
jonross 2014/12/10 17:57:30 Done.
72 // SetRotationLocked(false) removes the rotation lock.
73 void LockRotation(gfx::Display::Rotation rotation);
74
36 // Locks rotation to the angle matching the primary orientation for 75 // Locks rotation to the angle matching the primary orientation for
37 // |lock_orientation|. 76 // |lock_orientation|.
38 void LockRotationToPrimaryOrientation( 77 void LockRotationToPrimaryOrientation(
39 blink::WebScreenOrientationLockType lock_orientation); 78 blink::WebScreenOrientationLockType lock_orientation);
40 79
41 // Locks rotation to the angle matching the secondary orientation for 80 // Locks rotation to the angle matching the secondary orientation for
42 // |lock_orientation|. 81 // |lock_orientation|.
43 void LockRotationToSecondaryOrientation( 82 void LockRotationToSecondaryOrientation(
44 blink::WebScreenOrientationLockType lock_orientation); 83 blink::WebScreenOrientationLockType lock_orientation);
45 84
46 // For orientations that do not specify primary or secondary, locks to the 85 // For orientations that do not specify primary or secondary, locks to the
47 // current rotation if it matches |lock_orientation|. Otherwise locks to a 86 // current rotation if it matches |lock_orientation|. Otherwise locks to a
48 // matching rotation. 87 // matching rotation.
49 void LockToRotationMatchingOrientation( 88 void LockToRotationMatchingOrientation(
50 blink::WebScreenOrientationLockType lock_orientation); 89 blink::WebScreenOrientationLockType lock_orientation);
51 90
52 // The window that has applied the current lock. No other window can apply a 91 // The window that has applied the current lock. No other window can apply a
53 // lock until the current window unlocks rotation. 92 // lock until the current window unlocks rotation.
54 aura::Window* locking_window_; 93 aura::Window* locking_window_;
55 94
56 // The orientation of the display when at a rotation of 0. 95 // The orientation of the display when at a rotation of 0.
57 blink::WebScreenOrientationLockType natural_orientation_; 96 blink::WebScreenOrientationLockType natural_orientation_;
58 97
98 // True when changes being applied cause OnDisplayConfigurationChanged() to be
99 // called, and for which these changes should be ignored.
100 bool ignore_display_configuration_updates_;
101
102 // When true then accelerometer updates should not rotate the display.
103 bool rotation_locked_;
104
105 // Rotation Lock observers.
106 ObserverList<Observer> observers_;
107
59 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationDelegate); 108 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationDelegate);
60 }; 109 };
61 110
62 } // namespace ash 111 } // namespace ash
63 112
64 #endif // ASH_CONTENT_DISPLAY_SCREEN_ORIENTATION_DELEGATE_CHROMEOS_H_ 113 #endif // ASH_CONTENT_DISPLAY_SCREEN_ORIENTATION_DELEGATE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698