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

Side by Side Diff: base/power_monitor/power_monitor_device_source.cc

Issue 17074009: Created multi-process-friendly PowerMonitor interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing windows unit test errors Created 7 years, 4 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 2013 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 #include "base/power_monitor/power_monitor_device_source.h"
6
7 #include "base/time/time.h"
8
9 namespace base {
10
11 #if defined(ENABLE_BATTERY_MONITORING)
12 // The amount of time (in ms) to wait before running the initial
13 // battery check.
14 static int kDelayedBatteryCheckMs = 10 * 1000;
15 #endif // defined(ENABLE_BATTERY_MONITORING)
16
17 PowerMonitorDeviceSource::PowerMonitorDeviceSource() {
18 DCHECK(MessageLoop::current());
19 #if defined(ENABLE_BATTERY_MONITORING)
20 delayed_battery_check_.Start(FROM_HERE,
21 base::TimeDelta::FromMilliseconds(kDelayedBatteryCheckMs), this,
22 &PowerMonitorDeviceSource::BatteryCheck);
23 #endif // defined(ENABLE_BATTERY_MONITORING)
24 #if defined(OS_MACOSX)
25 PlatformInit();
26 #endif
27 }
28
29 PowerMonitorDeviceSource::~PowerMonitorDeviceSource() {
30 #if defined(OS_MACOSX)
31 PlatformDestroy();
32 #endif
33 }
34
35 void PowerMonitorDeviceSource::BatteryCheck() {
36 ProcessPowerEvent(PowerMonitorSource::POWER_STATE_EVENT);
37 }
38
39 } // namespace base
OLDNEW
« no previous file with comments | « base/power_monitor/power_monitor_device_source.h ('k') | base/power_monitor/power_monitor_device_source_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698