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