| 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_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_ | 5 #ifndef ASH_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_ | 
| 6 #define ASH_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_ | 6 #define ASH_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_ | 
| 7 | 7 | 
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" | 
| 9 #include "ash/system/chromeos/power/power_status.h" | 9 #include "ash/system/chromeos/power/power_status.h" | 
| 10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" | 
| 11 | 11 | 
| 12 namespace views { | 12 namespace views { | 
| 13 class ImageView; | 13 class ImageView; | 
| 14 class Label; | 14 class Label; | 
| 15 } | 15 } | 
| 16 | 16 | 
| 17 namespace ash { | 17 namespace ash { | 
| 18 | 18 | 
| 19 class ASH_EXPORT PowerStatusView : public views::View, | 19 class ASH_EXPORT PowerStatusView : public views::View, | 
| 20                                    public PowerStatus::Observer { | 20                                    public PowerStatus::Observer { | 
| 21  public: | 21  public: | 
| 22   enum ViewType { | 22   PowerStatusView(bool default_view_right_align); | 
| 23     VIEW_DEFAULT, |  | 
| 24     VIEW_NOTIFICATION |  | 
| 25   }; |  | 
| 26 |  | 
| 27   PowerStatusView(ViewType view_type, bool default_view_right_align); |  | 
| 28   ~PowerStatusView() override; | 23   ~PowerStatusView() override; | 
| 29 | 24 | 
| 30   // Overridden from views::View. | 25   // Overridden from views::View. | 
| 31   gfx::Size GetPreferredSize() const override; | 26   gfx::Size GetPreferredSize() const override; | 
| 32   int GetHeightForWidth(int width) const override; | 27   int GetHeightForWidth(int width) const override; | 
| 33   void Layout() override; | 28   void Layout() override; | 
| 34 | 29 | 
| 35   // Overridden from PowerStatus::Observer. | 30   // Overridden from PowerStatus::Observer. | 
| 36   void OnPowerStatusChanged() override; | 31   void OnPowerStatusChanged() override; | 
| 37 | 32 | 
| 38  private: | 33  private: | 
| 39   friend class PowerStatusDefaultViewTest; | 34   friend class PowerStatusViewTest; | 
| 40   friend class PowerStatusNotificationViewTest; |  | 
| 41 | 35 | 
| 42   void LayoutDefaultView(); | 36   void LayoutView(); | 
| 43   void LayoutNotificationView(); | 37   void UpdateText(); | 
| 44   void UpdateTextForDefaultView(); |  | 
| 45   void UpdateTextForNotificationView(); |  | 
| 46 | 38 | 
| 47   // Overridden from views::View. | 39   // Overridden from views::View. | 
| 48   void ChildPreferredSizeChanged(views::View* child) override; | 40   void ChildPreferredSizeChanged(views::View* child) override; | 
| 49 | 41 | 
| 50   // Layout default view UI items on the right side of system tray pop up item | 42   // Layout default view UI items on the right side of system tray pop up item | 
| 51   // if true; otherwise, layout the UI items on the left side. | 43   // if true; otherwise, layout the UI items on the left side. | 
| 52   bool default_view_right_align_; | 44   bool default_view_right_align_; | 
| 53 | 45 | 
| 54   // Labels used only for VIEW_NOTIFICATION. |  | 
| 55   views::Label* status_label_; |  | 
| 56   views::Label* time_label_; |  | 
| 57 |  | 
| 58   // Labels used only for VIEW_DEFAULT. |  | 
| 59   views::Label* time_status_label_; | 46   views::Label* time_status_label_; | 
| 60   views::Label* percentage_label_; | 47   views::Label* percentage_label_; | 
| 61 | 48 | 
| 62   // Battery status indicator icon. | 49   // Battery status indicator icon. | 
| 63   views::ImageView* icon_; | 50   views::ImageView* icon_; | 
| 64 | 51 | 
| 65   ViewType view_type_; |  | 
| 66 |  | 
| 67   DISALLOW_COPY_AND_ASSIGN(PowerStatusView); | 52   DISALLOW_COPY_AND_ASSIGN(PowerStatusView); | 
| 68 }; | 53 }; | 
| 69 | 54 | 
| 70 }  // namespace ash | 55 }  // namespace ash | 
| 71 | 56 | 
| 72 #endif  // ASH_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_ | 57 #endif  // ASH_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_ | 
| OLD | NEW | 
|---|