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> | 8 #include <map> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "ash/display/display_controller.h" | 11 #include "ash/display/display_controller.h" |
12 #include "ash/display/display_info.h" | 12 #include "ash/display/display_info.h" |
13 #include "ash/system/tray/system_tray_item.h" | 13 #include "ash/system/tray/system_tray_item.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
16 | 16 |
17 namespace ash { | 17 namespace ash { |
18 class DisplayView; | 18 class DisplayView; |
19 | 19 |
20 namespace test { | 20 namespace test { |
21 class AshTestBase; | 21 class AshTestBase; |
22 } | 22 } |
23 | 23 |
24 class ASH_EXPORT TrayDisplay : public SystemTrayItem, | 24 class ASH_EXPORT TrayDisplay : public SystemTrayItem, |
25 public DisplayController::Observer { | 25 public DisplayController::Observer { |
26 public: | 26 public: |
| 27 // Identifier for all message center notifications. |
| 28 static const char kNotificationId[]; |
| 29 |
27 explicit TrayDisplay(SystemTray* system_tray); | 30 explicit TrayDisplay(SystemTray* system_tray); |
28 virtual ~TrayDisplay(); | 31 virtual ~TrayDisplay(); |
29 | 32 |
30 // Overridden from DisplayControllerObserver: | 33 // Overridden from DisplayControllerObserver: |
31 virtual void OnDisplayConfigurationChanged() OVERRIDE; | 34 virtual void OnDisplayConfigurationChanged() OVERRIDE; |
32 | 35 |
33 private: | 36 private: |
34 friend class TrayDisplayTest; | 37 friend class TrayDisplayTest; |
35 | 38 |
36 typedef std::map<int64, DisplayInfo> DisplayInfoMap; | 39 typedef std::map<int64, DisplayInfo> DisplayInfoMap; |
37 | 40 |
38 static const char kNotificationId[]; | |
39 | |
40 // Scans the current display info and updates |display_info_|. Sets the | 41 // Scans the current display info and updates |display_info_|. Sets the |
41 // previous data to |old_info| if it's not NULL. | 42 // previous data to |old_info| if it's not NULL. |
42 void UpdateDisplayInfo(DisplayInfoMap* old_info); | 43 void UpdateDisplayInfo(DisplayInfoMap* old_info); |
43 | 44 |
44 // Compares the current display settings with |old_info| and determine what | 45 // Compares the current display settings with |old_info| and determine what |
45 // message should be shown for notification. Returns true if there's a | 46 // message should be shown for notification. Returns true if there's a |
46 // meaningful change. Note that it's possible to return true and set | 47 // meaningful change. Note that it's possible to return true and set |
47 // |message_out| to empty, which means the notification should be removed. It | 48 // |message_out| to empty, which means the notification should be removed. It |
48 // also sets |additional_message_out| which appears in the notification with | 49 // also sets |additional_message_out| which appears in the notification with |
49 // the |message_out|. | 50 // the |message_out|. |
(...skipping 19 matching lines...) Expand all Loading... |
69 | 70 |
70 DisplayView* default_; | 71 DisplayView* default_; |
71 DisplayInfoMap display_info_; | 72 DisplayInfoMap display_info_; |
72 | 73 |
73 DISALLOW_COPY_AND_ASSIGN(TrayDisplay); | 74 DISALLOW_COPY_AND_ASSIGN(TrayDisplay); |
74 }; | 75 }; |
75 | 76 |
76 } // namespace ash | 77 } // namespace ash |
77 | 78 |
78 #endif // ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_ | 79 #endif // ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_ |
OLD | NEW |