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/strings/string16.h" |
| 15 #include "ui/views/view.h" |
10 | 16 |
11 namespace views { | 17 namespace ash { |
12 class View; | 18 namespace test { |
| 19 class AshTestBase; |
13 } | 20 } |
14 | 21 |
15 namespace ash { | |
16 namespace internal { | 22 namespace internal { |
17 | 23 |
18 enum TrayDisplayMode { | |
19 TRAY_DISPLAY_SINGLE, | |
20 TRAY_DISPLAY_EXTENDED, | |
21 TRAY_DISPLAY_MIRRORED, | |
22 TRAY_DISPLAY_DOCKED, | |
23 }; | |
24 | |
25 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 test::AshTestBase; |
| 34 friend class TrayDisplayTest; |
| 35 |
| 36 typedef std::map<int64, DisplayInfo> DisplayInfoMap; |
| 37 |
| 38 // Checks the current display settings and determine what message should be |
| 39 // shown for notification. |
| 40 base::string16 GetDisplayMessageForNotification(); |
| 41 |
35 // Overridden from SystemTrayItem. | 42 // Overridden from SystemTrayItem. |
36 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; | 43 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; |
37 virtual views::View* CreateNotificationView( | 44 virtual views::View* CreateNotificationView( |
38 user::LoginStatus status) OVERRIDE; | 45 user::LoginStatus status) OVERRIDE; |
39 virtual void DestroyDefaultView() OVERRIDE; | 46 virtual void DestroyDefaultView() OVERRIDE; |
40 virtual void DestroyNotificationView() OVERRIDE; | 47 virtual void DestroyNotificationView() OVERRIDE; |
41 virtual bool ShouldShowLauncher() const OVERRIDE; | 48 virtual bool ShouldShowLauncher() const OVERRIDE; |
42 | 49 |
43 // Overridden from DisplayControllerObserver: | 50 // Overridden from DisplayControllerObserver: |
44 virtual void OnDisplayConfigurationChanged() OVERRIDE; | 51 virtual void OnDisplayConfigurationChanged() OVERRIDE; |
45 | 52 |
46 DisplayView* default_; | 53 // Call this with |diabled| = false when the test case wants to see the |
| 54 // display notification. |
| 55 static void SetDisplayNotificationsDisabledForTest(bool disabled); |
| 56 |
| 57 // Test accessors. |
| 58 base::string16 GetDefaultViewMessage(); |
| 59 views::View* default_view() { return default_; } |
| 60 const string16& current_message() const { return current_message_; } |
| 61 |
| 62 views::View* default_; |
47 DisplayNotificationView* notification_; | 63 DisplayNotificationView* notification_; |
48 TrayDisplayMode current_mode_; | 64 string16 current_message_; |
| 65 DisplayInfoMap display_info_; |
49 | 66 |
50 DISALLOW_COPY_AND_ASSIGN(TrayDisplay); | 67 DISALLOW_COPY_AND_ASSIGN(TrayDisplay); |
51 }; | 68 }; |
52 | 69 |
53 } // namespace internal | 70 } // namespace internal |
54 } // namespace ash | 71 } // namespace ash |
55 | 72 |
56 #endif // ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_ | 73 #endif // ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_ |
OLD | NEW |