Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ash / system / chromeos / rotation / tray_rotation_lock.h
blob2a134d0b7ddd7e069b42b30f42315b414540b9b5
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.
5 #ifndef ASH_SYSTEM_CHROMEOS_ROTATION_TRAY_ROTATION_LOCK_H_
6 #define ASH_SYSTEM_CHROMEOS_ROTATION_TRAY_ROTATION_LOCK_H_
8 #include "ash/shell_observer.h"
9 #include "ash/system/tray/tray_image_item.h"
10 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
12 namespace ash {
14 namespace tray {
15 class RotationLockDefaultView;
16 } // namespace tray
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
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.
22 // TrayRotationLock is only available on the primary display.
23 class ASH_EXPORT TrayRotationLock : public TrayImageItem,
24 public MaximizeModeController::Observer,
25 public ShellObserver {
26 public:
27 explicit TrayRotationLock(SystemTray* system_tray);
28 virtual ~TrayRotationLock();
30 // MaximizeModeController::Observer:
31 virtual void OnRotationLockChanged(bool rotation_locked) OVERRIDE;
33 // SystemTrayItem:
34 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE;
36 // ShellObserver:
37 virtual void OnMaximizeModeStarted() OVERRIDE;
38 virtual void OnMaximizeModeEnded() OVERRIDE;
40 protected:
41 // TrayImageItem:
42 virtual bool GetInitialVisibility() OVERRIDE;
44 private:
45 friend class TrayRotationLockTest;
47 // True if |on_primary_display_|, maximize mode is enabled, and rotation is
48 // locked.
49 bool ShouldBeVisible();
51 // True if this has been created by a SystemTray on the primary display.
52 bool on_primary_display_;
54 DISALLOW_COPY_AND_ASSIGN(TrayRotationLock);
57 } // namespace ash
59 #endif // ASH_SYSTEM_CHROMEOS_ROTATION_TRAY_ROTATION_LOCK_H_