| 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_COMMON_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_ | 5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_ |
| 6 #define ASH_COMMON_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_ | 6 #define ASH_COMMON_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/common/system/chromeos/power/power_status.h" | 9 #include "ash/common/system/chromeos/power/power_status.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
| 13 | 13 |
| 14 namespace views { | 14 namespace views { |
| 15 class ImageView; | 15 class ImageView; |
| 16 class Label; | 16 class Label; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace ash { | 19 namespace ash { |
| 20 | 20 |
| 21 class ASH_EXPORT PowerStatusView : public views::View, | 21 class ASH_EXPORT PowerStatusView : public views::View, |
| 22 public PowerStatus::Observer { | 22 public PowerStatus::Observer { |
| 23 public: | 23 public: |
| 24 explicit PowerStatusView(bool default_view_right_align); | 24 explicit PowerStatusView(bool default_view_right_align); |
| 25 ~PowerStatusView() override; | 25 ~PowerStatusView() override; |
| 26 | 26 |
| 27 // views::View: | 27 // views::View: |
| 28 void Layout() override; | 28 void Layout() override; |
| 29 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | |
| 30 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | 29 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
| 31 | 30 |
| 32 // PowerStatus::Observer: | 31 // PowerStatus::Observer: |
| 33 void OnPowerStatusChanged() override; | 32 void OnPowerStatusChanged() override; |
| 34 | 33 |
| 35 private: | 34 private: |
| 36 friend class PowerStatusViewTest; | 35 friend class PowerStatusViewTest; |
| 37 | 36 |
| 38 void LayoutView(); | 37 void LayoutView(); |
| 39 void UpdateText(); | 38 void UpdateText(); |
| 40 void UpdateStyle(); | |
| 41 | 39 |
| 42 // views::View: | 40 // views::View: |
| 43 void ChildPreferredSizeChanged(views::View* child) override; | 41 void ChildPreferredSizeChanged(views::View* child) override; |
| 44 | 42 |
| 45 // Layout default view UI items on the right side of system tray pop up item | 43 // Layout default view UI items on the right side of system tray pop up item |
| 46 // if true; otherwise, layout the UI items on the left side. | 44 // if true; otherwise, layout the UI items on the left side. |
| 47 bool default_view_right_align_; | 45 bool default_view_right_align_; |
| 48 | 46 |
| 49 views::Label* percentage_label_; | 47 views::Label* percentage_label_; |
| 50 views::Label* separator_label_; | 48 views::Label* separator_label_; |
| 51 views::Label* time_status_label_; | 49 views::Label* time_status_label_; |
| 52 | 50 |
| 53 // Battery status indicator icon. Unused in material design. | 51 // Battery status indicator icon. Unused in material design. |
| 54 views::ImageView* icon_; | 52 views::ImageView* icon_; |
| 55 | 53 |
| 56 // Information about the image last used to update |icon_|. Cached to avoid | 54 // Information about the image last used to update |icon_|. Cached to avoid |
| 57 // unnecessary updates (http://crbug.com/589348). | 55 // unnecessary updates (http://crbug.com/589348). |
| 58 PowerStatus::BatteryImageInfo previous_battery_image_info_; | 56 PowerStatus::BatteryImageInfo previous_battery_image_info_; |
| 59 | 57 |
| 60 // Only used in material design. | 58 // Only used in material design. |
| 61 base::string16 accessible_name_; | 59 base::string16 accessible_name_; |
| 62 | 60 |
| 63 DISALLOW_COPY_AND_ASSIGN(PowerStatusView); | 61 DISALLOW_COPY_AND_ASSIGN(PowerStatusView); |
| 64 }; | 62 }; |
| 65 | 63 |
| 66 } // namespace ash | 64 } // namespace ash |
| 67 | 65 |
| 68 #endif // ASH_COMMON_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_ | 66 #endif // ASH_COMMON_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_ |
| OLD | NEW |