| 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_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_ | |
| 6 #define ASH_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_ | |
| 7 | |
| 8 #include "ash/ash_export.h" | |
| 9 #include "ash/system/chromeos/power/power_status.h" | |
| 10 #include "base/macros.h" | |
| 11 #include "ui/views/view.h" | |
| 12 | |
| 13 namespace views { | |
| 14 class ImageView; | |
| 15 class Label; | |
| 16 } | |
| 17 | |
| 18 namespace ash { | |
| 19 | |
| 20 class ASH_EXPORT PowerStatusView : public views::View, | |
| 21 public PowerStatus::Observer { | |
| 22 public: | |
| 23 PowerStatusView(bool default_view_right_align); | |
| 24 ~PowerStatusView() override; | |
| 25 | |
| 26 // Overridden from views::View. | |
| 27 gfx::Size GetPreferredSize() const override; | |
| 28 int GetHeightForWidth(int width) const override; | |
| 29 void Layout() override; | |
| 30 | |
| 31 // Overridden from PowerStatus::Observer. | |
| 32 void OnPowerStatusChanged() override; | |
| 33 | |
| 34 private: | |
| 35 friend class PowerStatusViewTest; | |
| 36 | |
| 37 void LayoutView(); | |
| 38 void UpdateText(); | |
| 39 | |
| 40 // Overridden from 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. | |
| 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 DISALLOW_COPY_AND_ASSIGN(PowerStatusView); | |
| 59 }; | |
| 60 | |
| 61 } // namespace ash | |
| 62 | |
| 63 #endif // ASH_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_ | |
| OLD | NEW |