From 49ab556cfe14de363a74ce771931832304a1a038 Mon Sep 17 00:00:00 2001 From: "satish@chromium.org" Date: Sat, 11 Dec 2010 09:13:54 +0000 Subject: Make members of Singleton private and only visible to the singleton type. This enforces that the Singleton pattern can only be used within classes which want singleton-ness. As part of this CL I have also fixed up files which got missed in my previous CLs to use a GetInstance() method and use Singleton from the source file. There are a small number of places where I have also switched to LazyInstance as that was more appropriate for types used in a single source file. BUG=65298 TEST=all existing tests should continue to pass. Review URL: http://codereview.chromium.org/5682008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68932 0039d316-1c4b-4281-b951-d872f2087c98 --- views/focus/focus_manager.cc | 8 +++++++- views/focus/focus_manager.h | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'views') diff --git a/views/focus/focus_manager.cc b/views/focus/focus_manager.cc index 4848e4b..e8a3e7e 100644 --- a/views/focus/focus_manager.cc +++ b/views/focus/focus_manager.cc @@ -63,6 +63,12 @@ void FocusManager::WidgetFocusManager::OnWidgetFocusEvent( } } +// static +FocusManager::WidgetFocusManager* +FocusManager::WidgetFocusManager::GetInstance() { + return Singleton::get(); +} + // FocusManager ----------------------------------------------------- FocusManager::FocusManager(Widget* widget) @@ -82,7 +88,7 @@ FocusManager::~FocusManager() { // static FocusManager::WidgetFocusManager* FocusManager::GetWidgetFocusManager() { - return Singleton::get(); + return WidgetFocusManager::GetInstance(); } bool FocusManager::OnKeyEvent(const KeyEvent& event) { diff --git a/views/focus/focus_manager.h b/views/focus/focus_manager.h index 28f97b4..6eee79d 100644 --- a/views/focus/focus_manager.h +++ b/views/focus/focus_manager.h @@ -126,6 +126,9 @@ class FocusManager { public: class WidgetFocusManager { public: + // Returns the singleton instance. + static WidgetFocusManager* GetInstance(); + // Adds/removes a WidgetFocusChangeListener |listener| to the set of // active listeners. void AddFocusChangeListener(WidgetFocusChangeListener* listener); -- cgit v1.1