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

Side by Side Diff: device/battery/battery_status_service.h

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 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 | « crypto/openssl_util.cc ('k') | device/battery/battery_status_service.cc » ('j') | 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 #ifndef DEVICE_BATTERY_BATTERY_STATUS_SERVICE_H_ 5 #ifndef DEVICE_BATTERY_BATTERY_STATUS_SERVICE_H_
6 #define DEVICE_BATTERY_BATTERY_STATUS_SERVICE_H_ 6 #define DEVICE_BATTERY_BATTERY_STATUS_SERVICE_H_
7 7
8 #include "base/callback_list.h" 8 #include "base/callback_list.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 27 matching lines...) Expand all
38 void Shutdown(); 38 void Shutdown();
39 39
40 // Injects a custom battery status manager for testing purposes. 40 // Injects a custom battery status manager for testing purposes.
41 void SetBatteryManagerForTesting( 41 void SetBatteryManagerForTesting(
42 scoped_ptr<BatteryStatusManager> test_battery_manager); 42 scoped_ptr<BatteryStatusManager> test_battery_manager);
43 43
44 // Returns callback to invoke when battery is changed. Used for testing. 44 // Returns callback to invoke when battery is changed. Used for testing.
45 const BatteryUpdateCallback& GetUpdateCallbackForTesting() const; 45 const BatteryUpdateCallback& GetUpdateCallbackForTesting() const;
46 46
47 private: 47 private:
48 friend struct DefaultSingletonTraits<BatteryStatusService>; 48 friend struct base::DefaultSingletonTraits<BatteryStatusService>;
49 friend class BatteryStatusServiceTest; 49 friend class BatteryStatusServiceTest;
50 50
51 BatteryStatusService(); 51 BatteryStatusService();
52 virtual ~BatteryStatusService(); 52 virtual ~BatteryStatusService();
53 53
54 // Updates current battery status and sends new status to interested 54 // Updates current battery status and sends new status to interested
55 // render processes. Can be called on any thread via a callback. 55 // render processes. Can be called on any thread via a callback.
56 void NotifyConsumers(const BatteryStatus& status); 56 void NotifyConsumers(const BatteryStatus& status);
57 void NotifyConsumersOnMainThread(const BatteryStatus& status); 57 void NotifyConsumersOnMainThread(const BatteryStatus& status);
58 void ConsumersChanged(); 58 void ConsumersChanged();
59 59
60 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 60 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
61 scoped_ptr<BatteryStatusManager> battery_fetcher_; 61 scoped_ptr<BatteryStatusManager> battery_fetcher_;
62 BatteryUpdateCallbackList callback_list_; 62 BatteryUpdateCallbackList callback_list_;
63 BatteryUpdateCallback update_callback_; 63 BatteryUpdateCallback update_callback_;
64 BatteryStatus status_; 64 BatteryStatus status_;
65 bool status_updated_; 65 bool status_updated_;
66 bool is_shutdown_; 66 bool is_shutdown_;
67 67
68 DISALLOW_COPY_AND_ASSIGN(BatteryStatusService); 68 DISALLOW_COPY_AND_ASSIGN(BatteryStatusService);
69 }; 69 };
70 70
71 } // namespace device 71 } // namespace device
72 72
73 #endif // DEVICE_BATTERY_BATTERY_STATUS_SERVICE_H_ 73 #endif // DEVICE_BATTERY_BATTERY_STATUS_SERVICE_H_
OLDNEW
« no previous file with comments | « crypto/openssl_util.cc ('k') | device/battery/battery_status_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698