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 ASH_SYSTEM_CHROMEOS_ROTATION_TRAY_ROTATION_LOCK_H_ | 5 #ifndef ASH_SYSTEM_CHROMEOS_ROTATION_TRAY_ROTATION_LOCK_H_ |
6 #define ASH_SYSTEM_CHROMEOS_ROTATION_TRAY_ROTATION_LOCK_H_ | 6 #define ASH_SYSTEM_CHROMEOS_ROTATION_TRAY_ROTATION_LOCK_H_ |
7 | 7 |
| 8 #include "ash/content/display/screen_orientation_controller_chromeos.h" |
8 #include "ash/shell_observer.h" | 9 #include "ash/shell_observer.h" |
9 #include "ash/system/tray/tray_image_item.h" | 10 #include "ash/system/tray/tray_image_item.h" |
10 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | |
11 | 11 |
12 namespace ash { | 12 namespace ash { |
13 | 13 |
14 namespace tray { | 14 namespace tray { |
15 class RotationLockDefaultView; | 15 class RotationLockDefaultView; |
16 } // namespace tray | 16 } // namespace tray |
17 | 17 |
18 // TrayRotationLock is a provider of views for the SystemTray. Both a tray view | 18 // TrayRotationLock is a provider of views for the SystemTray. Both a tray view |
19 // and a default view are provided. Each view indicates the current state of | 19 // and a default view are provided. Each view indicates the current state of |
20 // the rotation lock for the display which it appears on. The default view can | 20 // the rotation lock for the display which it appears on. The default view can |
21 // be interacted with, it toggles the state of the rotation lock. | 21 // be interacted with, it toggles the state of the rotation lock. |
22 // TrayRotationLock is only available on the primary display. | 22 // TrayRotationLock is only available on the primary display. |
23 class ASH_EXPORT TrayRotationLock : public TrayImageItem, | 23 class ASH_EXPORT TrayRotationLock |
24 public MaximizeModeController::Observer, | 24 : public TrayImageItem, |
25 public ShellObserver { | 25 public ScreenOrientationController::Observer, |
| 26 public ShellObserver { |
26 public: | 27 public: |
27 explicit TrayRotationLock(SystemTray* system_tray); | 28 explicit TrayRotationLock(SystemTray* system_tray); |
28 virtual ~TrayRotationLock(); | 29 ~TrayRotationLock() override; |
29 | 30 |
30 // MaximizeModeController::Observer: | 31 // ScreenOrientationController::Observer: |
31 virtual void OnRotationLockChanged(bool rotation_locked) override; | 32 void OnRotationLockChanged(bool rotation_locked) override; |
32 | 33 |
33 // SystemTrayItem: | 34 // SystemTrayItem: |
34 virtual views::View* CreateDefaultView(user::LoginStatus status) override; | 35 views::View* CreateDefaultView(user::LoginStatus status) override; |
35 | 36 |
36 // ShellObserver: | 37 // ShellObserver: |
37 virtual void OnMaximizeModeStarted() override; | 38 void OnMaximizeModeStarted() override; |
38 virtual void OnMaximizeModeEnded() override; | 39 void OnMaximizeModeEnded() override; |
39 | 40 |
40 protected: | 41 protected: |
41 // TrayImageItem: | 42 // TrayImageItem: |
42 virtual bool GetInitialVisibility() override; | 43 bool GetInitialVisibility() override; |
43 | 44 |
44 private: | 45 private: |
45 friend class TrayRotationLockTest; | 46 friend class TrayRotationLockTest; |
46 | 47 |
47 // True if |on_primary_display_|, maximize mode is enabled, and rotation is | 48 // True if |on_primary_display_|, maximize mode is enabled, and rotation is |
48 // locked. | 49 // locked. |
49 bool ShouldBeVisible(); | 50 bool ShouldBeVisible(); |
50 | 51 |
51 // True if this has been created by a SystemTray on the primary display. | 52 // True if this has been created by a SystemTray on the primary display. |
52 bool on_primary_display_; | 53 bool on_primary_display_; |
53 | 54 |
54 DISALLOW_COPY_AND_ASSIGN(TrayRotationLock); | 55 DISALLOW_COPY_AND_ASSIGN(TrayRotationLock); |
55 }; | 56 }; |
56 | 57 |
57 } // namespace ash | 58 } // namespace ash |
58 | 59 |
59 #endif // ASH_SYSTEM_CHROMEOS_ROTATION_TRAY_ROTATION_LOCK_H_ | 60 #endif // ASH_SYSTEM_CHROMEOS_ROTATION_TRAY_ROTATION_LOCK_H_ |
OLD | NEW |