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

Unified Diff: app/system_monitor.h

Issue 431008: Make SystemMonitor not a Singleton and move it out of base (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: fix ChromeFrame build Created 11 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: app/system_monitor.h
diff --git a/base/system_monitor.h b/app/system_monitor.h
similarity index 86%
rename from base/system_monitor.h
rename to app/system_monitor.h
index 71d8436c442ecbec4c984837944135c31f2e6453..abafe4faae98b626f68c6533d84cf3a83ed516ff 100644
--- a/base/system_monitor.h
+++ b/app/system_monitor.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_SYSTEM_MONITOR_H_
-#define BASE_SYSTEM_MONITOR_H_
+#ifndef APP_SYSTEM_MONITOR_H_
+#define APP_SYSTEM_MONITOR_H_
#include "build/build_config.h"
@@ -20,23 +20,18 @@
#include "base/timer.h"
#endif // defined(ENABLE_BATTERY_MONITORING)
-namespace base {
-
// Class for monitoring various system-related subsystems
// such as power management, network status, etc.
// TODO(mbelshe): Add support beyond just power management.
class SystemMonitor {
public:
- // Retrieves the Singleton.
- static SystemMonitor* Get();
+ // Create SystemMonitor. Only one SystemMonitor instance per application
+ // is allowed.
+ SystemMonitor();
+ ~SystemMonitor();
- // Start the System Monitor within a process. This method
- // is provided so that the battery check can be deferred.
- // The MessageLoop must be started before calling this
- // method.
- // This is a no-op on platforms for which ENABLE_BATTERY_MONITORING is
- // disabled.
- static void Start();
+ // Get the application-wide SystemMonitor (if not present, returns NULL).
+ static SystemMonitor* Get();
//
// Power-related APIs
@@ -94,10 +89,6 @@ class SystemMonitor {
// Cross-platform handling of a power event.
void ProcessPowerMessage(PowerEvent event_id);
- // Constructor.
- // Don't use this; access SystemMonitor via the Singleton.
- SystemMonitor();
-
private:
// Platform-specific method to check whether the system is currently
// running on battery power. Returns true if running on batteries,
@@ -124,6 +115,4 @@ class SystemMonitor {
DISALLOW_COPY_AND_ASSIGN(SystemMonitor);
};
-}
-
-#endif // BASE_SYSTEM_MONITOR_H_
+#endif // APP_SYSTEM_MONITOR_H_

Powered by Google App Engine
This is Rietveld 408576698