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

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

Issue 1874313002: Convert device to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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
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.h" 5 #include "device/battery/battery_status_manager.h"
6 6
7 #include <CoreFoundation/CoreFoundation.h> 7 #include <CoreFoundation/CoreFoundation.h>
8 #include <IOKit/ps/IOPSKeys.h>
8 #include <IOKit/ps/IOPowerSources.h> 9 #include <IOKit/ps/IOPowerSources.h>
9 #include <IOKit/ps/IOPSKeys.h> 10
11 #include <memory>
10 #include <vector> 12 #include <vector>
11 13
12 #include "base/mac/foundation_util.h" 14 #include "base/mac/foundation_util.h"
13 #include "base/mac/scoped_cftyperef.h" 15 #include "base/mac/scoped_cftyperef.h"
14 #include "base/macros.h" 16 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
17 #include "base/time/time.h" 18 #include "base/time/time.h"
18 19
19 namespace device { 20 namespace device {
20 21
21 namespace { 22 namespace {
22 23
23 typedef BatteryStatusService::BatteryUpdateCallback BatteryCallback; 24 typedef BatteryStatusService::BatteryUpdateCallback BatteryCallback;
24 25
25 // Returns the value corresponding to |key| in the dictionary |description|. 26 // Returns the value corresponding to |key| in the dictionary |description|.
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 bool StartListeningBatteryChange() override { 221 bool StartListeningBatteryChange() override {
221 notifier_->Start(); 222 notifier_->Start();
222 return true; 223 return true;
223 } 224 }
224 225
225 void StopListeningBatteryChange() override { 226 void StopListeningBatteryChange() override {
226 notifier_->Stop(); 227 notifier_->Stop();
227 } 228 }
228 229
229 private: 230 private:
230 scoped_ptr<BatteryStatusObserver> notifier_; 231 std::unique_ptr<BatteryStatusObserver> notifier_;
231 232
232 DISALLOW_COPY_AND_ASSIGN(BatteryStatusManagerMac); 233 DISALLOW_COPY_AND_ASSIGN(BatteryStatusManagerMac);
233 }; 234 };
234 235
235 } // end namespace 236 } // end namespace
236 237
237 // static 238 // static
238 scoped_ptr<BatteryStatusManager> BatteryStatusManager::Create( 239 std::unique_ptr<BatteryStatusManager> BatteryStatusManager::Create(
239 const BatteryStatusService::BatteryUpdateCallback& callback) { 240 const BatteryStatusService::BatteryUpdateCallback& callback) {
240 return scoped_ptr<BatteryStatusManager>( 241 return std::unique_ptr<BatteryStatusManager>(
241 new BatteryStatusManagerMac(callback)); 242 new BatteryStatusManagerMac(callback));
242 } 243 }
243 244
244 } // namespace device 245 } // namespace device
OLDNEW
« no previous file with comments | « device/battery/battery_status_manager_linux.cc ('k') | device/battery/battery_status_manager_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698