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

Unified Diff: chrome/browser/chromeos/settings/cros_settings.h

Issue 14200028: Make CrosSettings and DeviceSettingsService non Lazy instances (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/settings/cros_settings.h
diff --git a/chrome/browser/chromeos/settings/cros_settings.h b/chrome/browser/chromeos/settings/cros_settings.h
index 4148ee69e848f90af14a60e2851a5ac7cfdb68a0..8420c8d23c22218ebf523d359f1e924af0ff8c4f 100644
--- a/chrome/browser/chromeos/settings/cros_settings.h
+++ b/chrome/browser/chromeos/settings/cros_settings.h
@@ -17,7 +17,6 @@
#include "content/public/browser/notification_observer.h"
namespace base {
-template <typename T> struct DefaultLazyInstanceTraits;
class ListValue;
class Value;
}
@@ -27,7 +26,10 @@ namespace chromeos {
// This class manages per-device/global settings.
class CrosSettings : public base::NonThreadSafe {
public:
- // Class factory.
+ // Manage singleton instance.
+ static void Initialize();
+ static bool IsInitialized();
+ static void Shutdown();
static CrosSettings* Get();
// Helper function to test if the given |path| is a valid cros setting.
@@ -92,12 +94,10 @@ class CrosSettings : public base::NonThreadSafe {
CrosSettingsProvider* GetProvider(const std::string& path) const;
private:
- friend struct base::DefaultLazyInstanceTraits<CrosSettings>;
friend class CrosSettingsTest;
- // Public for testing.
CrosSettings();
- ~CrosSettings();
+ virtual ~CrosSettings();
// Fires system setting change notification.
void FireObservers(const std::string& path);
@@ -116,6 +116,20 @@ class CrosSettings : public base::NonThreadSafe {
DISALLOW_COPY_AND_ASSIGN(CrosSettings);
};
+// Helper class for unit tests. Initializes DeviceSettingsService if it has
+// not already been initialized (e.g. by ScopedDeviceSettingsTestHelper)
+// and initializes CrosSettings.
+class ScopedTestCrosSettings {
+ public:
+ ScopedTestCrosSettings();
+ ~ScopedTestCrosSettings();
+
+ private:
+ bool initialized_device_settings_service_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedTestCrosSettings);
+};
+
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_SETTINGS_CROS_SETTINGS_H_
« no previous file with comments | « chrome/browser/chromeos/proxy_config_service_impl_unittest.cc ('k') | chrome/browser/chromeos/settings/cros_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698