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

Unified Diff: chrome_frame/policy_settings.h

Issue 5581008: Add a new GetInstance() method for singleton classes, take 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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_frame/policy_settings.h
diff --git a/chrome_frame/policy_settings.h b/chrome_frame/policy_settings.h
index 28182bd7f94bb201edae237becea0a600e0eb759..72e32d224fdeb0573615334fa4cda5f44d5cbca5 100644
--- a/chrome_frame/policy_settings.h
+++ b/chrome_frame/policy_settings.h
@@ -7,6 +7,7 @@
#include <string>
#include <vector>
+#include "base/singleton.h"
#include "base/basictypes.h"
@@ -21,12 +22,7 @@ class PolicySettings {
RENDER_IN_CHROME_FRAME,
};
- PolicySettings() : default_renderer_(RENDERER_NOT_SPECIFIED) {
- RefreshFromRegistry();
- }
-
- ~PolicySettings() {
- }
+ static PolicySettings* GetInstance();
RendererForUrl default_renderer() const {
return default_renderer_;
@@ -50,6 +46,13 @@ class PolicySettings {
static void ReadApplicationLocaleSetting(std::wstring* application_locale);
protected:
+ PolicySettings() : default_renderer_(RENDERER_NOT_SPECIFIED) {
+ RefreshFromRegistry();
+ }
+
+ ~PolicySettings() {
+ }
+
// Protected for now since the class is not thread safe.
void RefreshFromRegistry();
@@ -60,8 +63,9 @@ class PolicySettings {
std::wstring application_locale_;
private:
+ // This ensures no construction is possible outside of the class itself.
+ friend struct DefaultSingletonTraits<PolicySettings>;
DISALLOW_COPY_AND_ASSIGN(PolicySettings);
};
-
#endif // CHROME_FRAME_POLICY_SETTINGS_H_

Powered by Google App Engine
This is Rietveld 408576698