| 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_POWER_POWER_STATUS_VIEW_H_ | 5 #ifndef ASH_SYSTEM_POWER_POWER_STATUS_VIEW_H_ |
| 6 #define ASH_SYSTEM_POWER_POWER_STATUS_VIEW_H_ | 6 #define ASH_SYSTEM_POWER_POWER_STATUS_VIEW_H_ |
| 7 | 7 |
| 8 #include "ash/system/power/power_supply_status.h" | 8 #include "ash/system/power/power_supply_status.h" |
| 9 #include "ui/views/view.h" | 9 #include "ui/views/view.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 PowerStatusView(ViewType view_type, bool default_view_right_align); | 26 PowerStatusView(ViewType view_type, bool default_view_right_align); |
| 27 virtual ~PowerStatusView() {} | 27 virtual ~PowerStatusView() {} |
| 28 | 28 |
| 29 void UpdatePowerStatus(const PowerSupplyStatus& status); | 29 void UpdatePowerStatus(const PowerSupplyStatus& status); |
| 30 const string16& accessible_name() const { return accessible_name_; } | 30 const string16& accessible_name() const { return accessible_name_; } |
| 31 | 31 |
| 32 // Overridden from views::View. | 32 // Overridden from views::View. |
| 33 virtual gfx::Size GetPreferredSize() OVERRIDE; | 33 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 34 virtual void Layout() OVERRIDE; |
| 34 | 35 |
| 35 private: | 36 private: |
| 36 void LayoutDefaultView(); | 37 void LayoutDefaultView(); |
| 37 void LayoutNotificationView(); | 38 void LayoutNotificationView(); |
| 38 void UpdateText(); | 39 void UpdateText(); |
| 39 void UpdateIcon(); | 40 void UpdateIcon(); |
| 40 void Update(); | 41 void Update(); |
| 41 void UpdateTextForDefaultView(); | 42 void UpdateTextForDefaultView(); |
| 42 void UpdateTextForNotificationView(); | 43 void UpdateTextForNotificationView(); |
| 43 int GetRoundedBatteryPercentage() const; | 44 int GetRoundedBatteryPercentage() const; |
| 44 string16 GetBatteryTimeAccessibilityString(int hour, int min); | 45 string16 GetBatteryTimeAccessibilityString(int hour, int min); |
| 45 | 46 |
| 46 // Overridden from views::View. | 47 // Overridden from views::View. |
| 47 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; | 48 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; |
| 48 | 49 |
| 49 // Layout default view UI items on the right side of system tray pop up item | 50 // Layout default view UI items on the right side of system tray pop up item |
| 50 // if true; otherwise, layout the UI items on the left side. | 51 // if true; otherwise, layout the UI items on the left side. |
| 51 bool default_view_right_align_; | 52 bool default_view_right_align_; |
| 52 | 53 |
| 53 // Labels used only for VIEW_NOTIFICATION. | 54 // Labels used only for VIEW_NOTIFICATION. |
| 54 views::Label* status_label_; | 55 views::Label* status_label_; |
| 55 views::Label* time_label_; | 56 views::Label* time_label_; |
| 56 | 57 |
| 57 // Labels used only for VIEW_DEFAULT. | 58 // Labels used only for VIEW_DEFAULT. |
| 58 views::Label* time_status_label_; | 59 views::Label* time_status_label_; |
| 60 views::Label* percentage_label_; |
| 59 | 61 |
| 60 // Battery status indicator icon. | 62 // Battery status indicator icon. |
| 61 views::ImageView* icon_; | 63 views::ImageView* icon_; |
| 62 | 64 |
| 63 // Index of the current icon in the icon array image, or -1 if unknown. | 65 // Index of the current icon in the icon array image, or -1 if unknown. |
| 64 int icon_image_index_; | 66 int icon_image_index_; |
| 65 | 67 |
| 66 ViewType view_type_; | 68 ViewType view_type_; |
| 67 | 69 |
| 68 PowerSupplyStatus supply_status_; | 70 PowerSupplyStatus supply_status_; |
| 69 | 71 |
| 70 string16 accessible_name_; | 72 string16 accessible_name_; |
| 71 | 73 |
| 72 DISALLOW_COPY_AND_ASSIGN(PowerStatusView); | 74 DISALLOW_COPY_AND_ASSIGN(PowerStatusView); |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 } // namespace internal | 77 } // namespace internal |
| 76 } // namespace ash | 78 } // namespace ash |
| 77 | 79 |
| 78 #endif // ASH_SYSTEM_POWER_POWER_STATUS_VIEW_H_ | 80 #endif // ASH_SYSTEM_POWER_POWER_STATUS_VIEW_H_ |
| OLD | NEW |