| 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 Label; | 15 class Label; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| 19 | 19 |
| 20 class ASH_EXPORT PowerStatusView : public views::View, | 20 class ASH_EXPORT PowerStatusView : public views::View, |
| 21 public PowerStatus::Observer { | 21 public PowerStatus::Observer { |
| 22 public: | 22 public: |
| 23 explicit PowerStatusView(bool default_view_right_align); | 23 PowerStatusView(); |
| 24 ~PowerStatusView() override; | 24 ~PowerStatusView() override; |
| 25 | 25 |
| 26 // views::View: | 26 // views::View: |
| 27 void Layout() override; | 27 void Layout() override; |
| 28 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | 28 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
| 29 | 29 |
| 30 // PowerStatus::Observer: | 30 // PowerStatus::Observer: |
| 31 void OnPowerStatusChanged() override; | 31 void OnPowerStatusChanged() override; |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 friend class PowerStatusViewTest; | 34 friend class PowerStatusViewTest; |
| 35 | 35 |
| 36 void LayoutView(); | |
| 37 void UpdateText(); | 36 void UpdateText(); |
| 38 | 37 |
| 39 // views::View: | 38 // views::View: |
| 40 void ChildPreferredSizeChanged(views::View* child) override; | 39 void ChildPreferredSizeChanged(views::View* child) override; |
| 41 | 40 |
| 42 // Layout default view UI items on the right side of system tray pop up item | |
| 43 // if true; otherwise, layout the UI items on the left side. | |
| 44 bool default_view_right_align_; | |
| 45 | |
| 46 views::Label* percentage_label_; | 41 views::Label* percentage_label_; |
| 47 views::Label* separator_label_; | 42 views::Label* separator_label_; |
| 48 views::Label* time_status_label_; | 43 views::Label* time_status_label_; |
| 49 | 44 |
| 50 // Only used in material design. | |
| 51 base::string16 accessible_name_; | 45 base::string16 accessible_name_; |
| 52 | 46 |
| 53 DISALLOW_COPY_AND_ASSIGN(PowerStatusView); | 47 DISALLOW_COPY_AND_ASSIGN(PowerStatusView); |
| 54 }; | 48 }; |
| 55 | 49 |
| 56 } // namespace ash | 50 } // namespace ash |
| 57 | 51 |
| 58 #endif // ASH_COMMON_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_ | 52 #endif // ASH_COMMON_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_ |
| OLD | NEW |