tray_display.h revision ca12bfac764ba476d6cd062bf1dde12cc64c3f40
1// Copyright (c) 2012 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_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_
6#define ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_
7
8#include <map>
9
10#include "ash/ash_export.h"
11#include "ash/display/display_controller.h"
12#include "ash/display/display_info.h"
13#include "ash/system/tray/system_tray_item.h"
14#include "base/strings/string16.h"
15#include "ui/views/view.h"
16
17namespace ash {
18namespace test {
19class AshTestBase;
20}
21
22namespace internal {
23
24class DisplayNotificationView;
25
26class ASH_EXPORT TrayDisplay : public SystemTrayItem,
27                               public DisplayController::Observer {
28 public:
29  explicit TrayDisplay(SystemTray* system_tray);
30  virtual ~TrayDisplay();
31
32  // Overridden from DisplayControllerObserver:
33  virtual void OnDisplayConfigurationChanged() OVERRIDE;
34
35 private:
36  friend class TrayDisplayTest;
37
38  typedef std::map<int64, DisplayInfo> DisplayInfoMap;
39
40  // Checks the current display settings and determine what message should be
41  // shown for notification. Returns true if there's a meaningful change. Note
42  // that it's possible to return true and set |message| to empty, which means
43  // the notification should be removed.
44  bool GetDisplayMessageForNotification(base::string16* message);
45
46  // Overridden from SystemTrayItem.
47  virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE;
48  virtual void DestroyDefaultView() OVERRIDE;
49
50  // Test accessors.
51  base::string16 GetDefaultViewMessage();
52  base::string16 GetNotificationMessage();
53  void CloseNotificationForTest();
54  views::View* default_view() { return default_; }
55
56  views::View* default_;
57  DisplayInfoMap display_info_;
58
59  DISALLOW_COPY_AND_ASSIGN(TrayDisplay);
60};
61
62}  // namespace internal
63}  // namespace ash
64
65#endif  // ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_
66