Chromium Code Reviews| 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_POWER_POWER_STATUS_VIEW_H_ | |
| 6 #define ASH_SYSTEM_POWER_POWER_STATUS_VIEW_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "ash/system/power/power_supply_status.h" | |
| 10 #include "ui/views/view.h" | |
| 11 | |
| 12 namespace views { | |
| 13 class ImageView; | |
| 14 class Label; | |
| 15 } | |
| 16 | |
| 17 namespace ash { | |
| 18 namespace internal { | |
| 19 namespace tray { | |
|
stevenjb
2012/06/07 01:31:18
I don't think we should use namespace tray for any
jennyz
2012/06/07 22:06:52
Done.
| |
| 20 | |
| 21 // This view is used only for the popup. | |
| 22 class PowerStatusView : public views::View { | |
| 23 public: | |
| 24 enum ViewType { | |
| 25 VIEW_DEFAULT, | |
| 26 VIEW_NOTIFICATION | |
| 27 }; | |
| 28 | |
| 29 explicit PowerStatusView(ViewType view_type); | |
| 30 virtual ~PowerStatusView() {} | |
| 31 | |
| 32 void UpdatePowerStatus(const PowerSupplyStatus& status); | |
| 33 | |
| 34 // Overridden from views::View. | |
| 35 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
| 36 | |
| 37 private: | |
| 38 void LayoutDefaultView(); | |
| 39 void LayoutNotificationView(); | |
| 40 void UpdateText(); | |
| 41 void UpdateIcon(); | |
| 42 void Update(); | |
| 43 void UpdateTextForDefaultView(); | |
| 44 void UpdateTextForNotificationView(); | |
| 45 | |
| 46 // Overridden from views::View. | |
| 47 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; | |
| 48 | |
| 49 // labels used only for VIEW_NOTIFICATION. | |
| 50 views::Label* status_label_; | |
| 51 views::Label* time_label_; | |
| 52 | |
| 53 // labels used only for VIEW_DEFAULT. | |
| 54 views::Label* time_status_label_; | |
| 55 | |
| 56 views::ImageView* icon_; | |
| 57 ViewType view_type_; | |
| 58 | |
| 59 PowerSupplyStatus supply_status_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(PowerStatusView); | |
| 62 }; | |
| 63 | |
| 64 } // namespace tray | |
| 65 } // namespace internal | |
| 66 } // namespace ash | |
| 67 | |
| 68 #endif // ASH_SYSTEM_POWER_POWER_STATUS_VIEW_H_ | |
| OLD | NEW |