Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: chrome/browser/chromeos/status/power_menu_button.h

Issue 10056001: chromeos: Remove old status-area related code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_
6 #define CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_
7 #pragma once
8
9 #include "base/compiler_specific.h"
10 #include "chrome/browser/chromeos/status/status_area_button.h"
11 #include "chromeos/dbus/power_manager_client.h"
12 #include "ui/views/controls/button/menu_button_listener.h"
13 #include "ui/views/controls/menu/menu_delegate.h"
14
15 namespace base {
16 class TimeDelta;
17 }
18
19 namespace views {
20 class MenuRunner;
21 }
22
23 namespace chromeos {
24
25 class StatusAreaBubbleContentView;
26
27 // The power menu button in the status area.
28 // This class will handle getting the power status and populating the menu.
29 class PowerMenuButton : public StatusAreaButton,
30 public views::MenuDelegate,
31 public views::MenuButtonListener,
32 public PowerManagerClient::Observer {
33 public:
34 explicit PowerMenuButton(StatusAreaButton::Delegate* delegate);
35 virtual ~PowerMenuButton();
36
37 // PowerManagerClient::Observer implementation.
38 virtual void PowerChanged(const PowerSupplyStatus& power_status) OVERRIDE;
39 virtual void SystemResumed() OVERRIDE {}
40
41 protected:
42 virtual int icon_width() OVERRIDE;
43
44 private:
45 // views::View
46 virtual void OnLocaleChanged() OVERRIDE;
47
48 // views::MenuButtonListener implementation.
49 virtual void OnMenuButtonClicked(views::View* source,
50 const gfx::Point& point) OVERRIDE;
51
52 // Format strings with power status
53 string16 GetBatteryIsChargedText() const;
54
55 // Update the power icon and menu label info depending on the power status.
56 void UpdateIconAndLabelInfo();
57
58 // Update status view
59 void UpdateStatusView();
60
61 // Update Battery time. Try to make it monotonically decreasing unless
62 // there's a large delta.
63 void UpdateBatteryTime(base::TimeDelta* previous,
64 const base::TimeDelta& current);
65
66 // Stored data gathered from PowerManagerClient.
67 bool battery_is_present_;
68 bool line_power_on_;
69 double battery_percentage_;
70 int battery_index_;
71 PowerSupplyStatus power_status_;
72
73 base::TimeDelta battery_time_to_full_;
74 base::TimeDelta battery_time_to_empty_;
75
76 // The currently showing status view. NULL if menu is not being displayed.
77 StatusAreaBubbleContentView* status_;
78
79 // If non-null the menu is showing.
80 scoped_ptr<views::MenuRunner> menu_runner_;
81
82 DISALLOW_COPY_AND_ASSIGN(PowerMenuButton);
83 };
84
85 } // namespace chromeos
86
87 #endif // CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/network_menu_button.cc ('k') | chrome/browser/chromeos/status/power_menu_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698