summaryrefslogtreecommitdiffstats
path: root/ash/system/chromeos/rotation/tray_rotation_lock.h
blob: 9c53e6ed268cd80c9e37f95438a7bb1eee957b4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_SYSTEM_CHROMEOS_ROTATION_TRAY_ROTATION_LOCK_H_
#define ASH_SYSTEM_CHROMEOS_ROTATION_TRAY_ROTATION_LOCK_H_

#include "ash/shell_observer.h"
#include "ash/system/tray/tray_image_item.h"

namespace ash {

namespace tray {
class RotationLockDefaultView;
}  // namespace tray

// TrayRotationLock is a provider of views for the SystemTray. Both a tray view
// and a default view are provided. Each view indicates the current state of
// the rotation lock for the display which it appears on. The default view can
// be interacted with, it toggles the state of the rotation lock.
// TrayRotationLock is only available on the primary display.
class ASH_EXPORT TrayRotationLock : public TrayImageItem,
                                    public ShellObserver {
 public:
  explicit TrayRotationLock(SystemTray* system_tray);
  virtual ~TrayRotationLock();

  // SystemTrayItem:
  virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE;

  // ShellObserver:
  virtual void OnMaximizeModeStarted() OVERRIDE;
  virtual void OnMaximizeModeEnded() OVERRIDE;

 protected:
  // TrayImageItem:
  virtual bool GetInitialVisibility() OVERRIDE;

 private:
  friend class TrayRotationLockTest;

  // True if this has been created by a SystemTray on the primary display.
  bool on_primary_display_;

  DISALLOW_COPY_AND_ASSIGN(TrayRotationLock);
};

}  // namespace ash

#endif  // ASH_SYSTEM_CHROMEOS_ROTATION_TRAY_ROTATION_LOCK_H_