OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_TRAY_DISPLAY_H_ | 5 #ifndef ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_ |
6 #define ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_ | 6 #define ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_ |
7 | 7 |
| 8 #include <map> |
| 9 |
| 10 #include "ash/ash_export.h" |
8 #include "ash/display/display_controller.h" | 11 #include "ash/display/display_controller.h" |
| 12 #include "ash/display/display_info.h" |
9 #include "ash/system/tray/system_tray_item.h" | 13 #include "ash/system/tray/system_tray_item.h" |
| 14 #include "base/string16.h" |
10 | 15 |
11 namespace views { | 16 namespace views { |
12 class View; | 17 class View; |
13 } | 18 } |
14 | 19 |
15 namespace ash { | 20 namespace ash { |
16 namespace internal { | 21 namespace internal { |
17 | 22 |
18 enum TrayDisplayMode { | |
19 TRAY_DISPLAY_SINGLE, | |
20 TRAY_DISPLAY_EXTENDED, | |
21 TRAY_DISPLAY_MIRRORED, | |
22 TRAY_DISPLAY_DOCKED, | |
23 }; | |
24 | |
25 class DisplayView; | 23 class DisplayView; |
26 class DisplayNotificationView; | 24 class DisplayNotificationView; |
27 | 25 |
28 class TrayDisplay : public SystemTrayItem, | 26 class ASH_EXPORT TrayDisplay : public SystemTrayItem, |
29 public DisplayController::Observer { | 27 public DisplayController::Observer { |
30 public: | 28 public: |
31 explicit TrayDisplay(SystemTray* system_tray); | 29 explicit TrayDisplay(SystemTray* system_tray); |
32 virtual ~TrayDisplay(); | 30 virtual ~TrayDisplay(); |
33 | 31 |
34 private: | 32 private: |
| 33 friend class TrayDisplayTest; |
| 34 |
| 35 // Checks the current display settings and determine what message should be |
| 36 // shown for notification. |
| 37 base::string16 GetDisplayMessageForNotification(); |
| 38 |
35 // Overridden from SystemTrayItem. | 39 // Overridden from SystemTrayItem. |
36 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; | 40 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; |
37 virtual views::View* CreateNotificationView( | 41 virtual views::View* CreateNotificationView( |
38 user::LoginStatus status) OVERRIDE; | 42 user::LoginStatus status) OVERRIDE; |
39 virtual void DestroyDefaultView() OVERRIDE; | 43 virtual void DestroyDefaultView() OVERRIDE; |
40 virtual void DestroyNotificationView() OVERRIDE; | 44 virtual void DestroyNotificationView() OVERRIDE; |
41 virtual bool ShouldShowLauncher() const OVERRIDE; | 45 virtual bool ShouldShowLauncher() const OVERRIDE; |
42 | 46 |
43 // Overridden from DisplayControllerObserver: | 47 // Overridden from DisplayControllerObserver: |
44 virtual void OnDisplayConfigurationChanged() OVERRIDE; | 48 virtual void OnDisplayConfigurationChanged() OVERRIDE; |
45 | 49 |
| 50 // Test utilities. |
| 51 bool IsDisplayViewVisibleForTest(); |
| 52 base::string16 GetTrayDisplayTextForTest(); |
| 53 base::string16 GetTrayDisplayTooltipTextForTest(); |
| 54 base::string16 GetDisplayNotificationTextForTest(); |
| 55 |
46 DisplayView* default_; | 56 DisplayView* default_; |
47 DisplayNotificationView* notification_; | 57 DisplayNotificationView* notification_; |
48 TrayDisplayMode current_mode_; | 58 string16 current_message_; |
| 59 std::map<int64, DisplayInfo> display_info_; |
49 | 60 |
50 DISALLOW_COPY_AND_ASSIGN(TrayDisplay); | 61 DISALLOW_COPY_AND_ASSIGN(TrayDisplay); |
51 }; | 62 }; |
52 | 63 |
53 } // namespace internal | 64 } // namespace internal |
54 } // namespace ash | 65 } // namespace ash |
55 | 66 |
56 #endif // ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_ | 67 #endif // ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_ |
OLD | NEW |