| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 explicit TrayDisplay(SystemTray* system_tray); | 27 explicit TrayDisplay(SystemTray* system_tray); |
| 28 virtual ~TrayDisplay(); | 28 virtual ~TrayDisplay(); |
| 29 | 29 |
| 30 // Overridden from DisplayControllerObserver: | 30 // Overridden from DisplayControllerObserver: |
| 31 virtual void OnDisplayConfigurationChanged() OVERRIDE; | 31 virtual void OnDisplayConfigurationChanged() override; |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 friend class TrayDisplayTest; | 34 friend class TrayDisplayTest; |
| 35 | 35 |
| 36 typedef std::map<int64, DisplayInfo> DisplayInfoMap; | 36 typedef std::map<int64, DisplayInfo> DisplayInfoMap; |
| 37 | 37 |
| 38 static const char kNotificationId[]; | 38 static const char kNotificationId[]; |
| 39 | 39 |
| 40 // Scans the current display info and updates |display_info_|. Sets the | 40 // Scans the current display info and updates |display_info_|. Sets the |
| 41 // previous data to |old_info| if it's not NULL. | 41 // previous data to |old_info| if it's not NULL. |
| 42 void UpdateDisplayInfo(DisplayInfoMap* old_info); | 42 void UpdateDisplayInfo(DisplayInfoMap* old_info); |
| 43 | 43 |
| 44 // Compares the current display settings with |old_info| and determine what | 44 // Compares the current display settings with |old_info| and determine what |
| 45 // message should be shown for notification. Returns true if there's a | 45 // 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 | 46 // 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 | 47 // |message_out| to empty, which means the notification should be removed. It |
| 48 // also sets |additional_message_out| which appears in the notification with | 48 // also sets |additional_message_out| which appears in the notification with |
| 49 // the |message_out|. | 49 // the |message_out|. |
| 50 bool GetDisplayMessageForNotification( | 50 bool GetDisplayMessageForNotification( |
| 51 const DisplayInfoMap& old_info, | 51 const DisplayInfoMap& old_info, |
| 52 base::string16* message_out, | 52 base::string16* message_out, |
| 53 base::string16* additional_message_out); | 53 base::string16* additional_message_out); |
| 54 | 54 |
| 55 // Creates or updates the display notification. | 55 // Creates or updates the display notification. |
| 56 void CreateOrUpdateNotification(const base::string16& message, | 56 void CreateOrUpdateNotification(const base::string16& message, |
| 57 const base::string16& additional_message); | 57 const base::string16& additional_message); |
| 58 | 58 |
| 59 // Overridden from SystemTrayItem. | 59 // Overridden from SystemTrayItem. |
| 60 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; | 60 virtual views::View* CreateDefaultView(user::LoginStatus status) override; |
| 61 virtual void DestroyDefaultView() OVERRIDE; | 61 virtual void DestroyDefaultView() override; |
| 62 | 62 |
| 63 // Test accessors. | 63 // Test accessors. |
| 64 base::string16 GetDefaultViewMessage() const; | 64 base::string16 GetDefaultViewMessage() const; |
| 65 bool GetAccessibleStateForTesting(ui::AXViewState* state); | 65 bool GetAccessibleStateForTesting(ui::AXViewState* state); |
| 66 const views::View* default_view() const { | 66 const views::View* default_view() const { |
| 67 return reinterpret_cast<views::View*>(default_); | 67 return reinterpret_cast<views::View*>(default_); |
| 68 } | 68 } |
| 69 | 69 |
| 70 DisplayView* default_; | 70 DisplayView* default_; |
| 71 DisplayInfoMap display_info_; | 71 DisplayInfoMap display_info_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(TrayDisplay); | 73 DISALLOW_COPY_AND_ASSIGN(TrayDisplay); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 } // namespace ash | 76 } // namespace ash |
| 77 | 77 |
| 78 #endif // ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_ | 78 #endif // ASH_SYSTEM_CHROMEOS_TRAY_DISPLAY_H_ |
| OLD | NEW |