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

Side by Side Diff: content/public/browser/battery_status_provider.h

Issue 10024013: chromeos: Add support for the battery status API on chromeos. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: file-move 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 CONTENT_PUBLIC_BROWSER_BATTERY_STATUS_PROVIDER_H_
6 #define CONTENT_PUBLIC_BROWSER_BATTERY_STATUS_PROVIDER_H_
7
8 #include <list>
9
10 #include "base/memory/singleton.h"
11 #include "base/observer_list.h"
12 #include "content/common/content_export.h"
13
14 namespace content {
15
16 struct CONTENT_EXPORT PowerSupplyStatus {
jam 2012/04/12 01:55:10 the content api, like the webkit api, puts each st
sadrul 2012/04/12 05:20:09 Done.
17 bool line_power_on;
18
19 bool battery_is_present;
20 bool battery_is_full;
21
22 // Time in seconds until the battery is empty or full, 0 for unknown.
23 int64 battery_seconds_to_empty;
24 int64 battery_seconds_to_full;
25
26 double battery_percentage;
27
28 bool is_calculating_battery_time;
29 };
30
31 class CONTENT_EXPORT BatteryStatusProvider {
32 public:
33 class CONTENT_EXPORT Observer {
jam 2012/04/12 01:55:10 this class is only used by content, so it doesn't
sadrul 2012/04/12 05:20:09 Done.
34 public:
35 virtual void PowerChanged(const PowerSupplyStatus& power_status) = 0;
36 };
37
38 static BatteryStatusProvider* GetInstance();
39
40 void AddObserver(Observer* observer);
jam 2012/04/12 01:55:10 for the content API we follow webkit API and only
sadrul 2012/04/12 05:20:09 Done.
41 void RemoveObserver(Observer* observer);
42
43 // Sends updated battery status information to all the observers.
44 void SendUpdate(const PowerSupplyStatus& power_status);
45
46 private:
47 friend struct DefaultSingletonTraits<BatteryStatusProvider>;
48
49 BatteryStatusProvider();
50 virtual ~BatteryStatusProvider();
51
52 ObserverList<Observer> observers_;
53
54 DISALLOW_COPY_AND_ASSIGN(BatteryStatusProvider);
55 };
56
57 } // namespace content
58
59 #endif // CONTENT_PUBLIC_BROWSER_BATTERY_STATUS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698