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