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.
5 #ifndef ASH_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_
6 #define ASH_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_
8 #include "ash/ash_export.h"
9 #include "ash/system/chromeos/power/power_status.h"
10 #include "ui/views/view.h"
19 class ASH_EXPORT PowerStatusView : public views::View,
20 public PowerStatus::Observer {
27 PowerStatusView(ViewType view_type, bool default_view_right_align);
28 virtual ~PowerStatusView();
30 // Overridden from views::View.
31 virtual gfx::Size GetPreferredSize() const override;
32 virtual int GetHeightForWidth(int width) const override;
33 virtual void Layout() override;
35 // Overridden from PowerStatus::Observer.
36 virtual void OnPowerStatusChanged() override;
39 friend class PowerStatusDefaultViewTest;
40 friend class PowerStatusNotificationViewTest;
42 void LayoutDefaultView();
43 void LayoutNotificationView();
44 void UpdateTextForDefaultView();
45 void UpdateTextForNotificationView();
47 // Overridden from views::View.
48 virtual void ChildPreferredSizeChanged(views::View* child) override;
50 // 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.
52 bool default_view_right_align_;
54 // Labels used only for VIEW_NOTIFICATION.
55 views::Label* status_label_;
56 views::Label* time_label_;
58 // Labels used only for VIEW_DEFAULT.
59 views::Label* time_status_label_;
60 views::Label* percentage_label_;
62 // Battery status indicator icon.
63 views::ImageView* icon_;
67 DISALLOW_COPY_AND_ASSIGN(PowerStatusView);
72 #endif // ASH_SYSTEM_CHROMEOS_POWER_POWER_STATUS_VIEW_H_