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

Side by Side Diff: device/battery/battery_status_manager_linux.cc

Issue 1263353004: Fix non-working battery status manager on Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/battery/battery_status_manager_linux.h" 5 #include "device/battery/battery_status_manager_linux.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 public: 267 public:
268 explicit BatteryStatusManagerLinux( 268 explicit BatteryStatusManagerLinux(
269 const BatteryStatusService::BatteryUpdateCallback& callback) 269 const BatteryStatusService::BatteryUpdateCallback& callback)
270 : callback_(callback) {} 270 : callback_(callback) {}
271 271
272 ~BatteryStatusManagerLinux() override {} 272 ~BatteryStatusManagerLinux() override {}
273 273
274 private: 274 private:
275 // BatteryStatusManager: 275 // BatteryStatusManager:
276 bool StartListeningBatteryChange() override { 276 bool StartListeningBatteryChange() override {
277 if (!StartNotifierThreadIfNecessary())
277 return false; 278 return false;
278 279
279 notifier_thread_->message_loop()->PostTask( 280 notifier_thread_->message_loop()->PostTask(
280 FROM_HERE, 281 FROM_HERE,
281 base::Bind(&BatteryStatusNotificationThread::StartListening, 282 base::Bind(&BatteryStatusNotificationThread::StartListening,
282 base::Unretained(notifier_thread_.get()))); 283 base::Unretained(notifier_thread_.get())));
283 return true; 284 return true;
284 } 285 }
285 286
286 void StopListeningBatteryChange() override { 287 void StopListeningBatteryChange() override {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 365 }
365 366
366 // static 367 // static
367 scoped_ptr<BatteryStatusManager> BatteryStatusManager::Create( 368 scoped_ptr<BatteryStatusManager> BatteryStatusManager::Create(
368 const BatteryStatusService::BatteryUpdateCallback& callback) { 369 const BatteryStatusService::BatteryUpdateCallback& callback) {
369 return scoped_ptr<BatteryStatusManager>( 370 return scoped_ptr<BatteryStatusManager>(
370 new BatteryStatusManagerLinux(callback)); 371 new BatteryStatusManagerLinux(callback));
371 } 372 }
372 373
373 } // namespace device 374 } // namespace device
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698