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

Unified Diff: chrome/browser/extensions/api/tabs/tabs_windows_api.cc

Issue 11649053: Banish boilerplate. Profile-keyed API factory for extension API classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jyasskin's Created 8 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/browser/extensions/api/tabs/tabs_windows_api.cc
diff --git a/chrome/browser/extensions/api/tabs/tabs_windows_api.cc b/chrome/browser/extensions/api/tabs/tabs_windows_api.cc
index 0efe88345f61cfbd66410de5555813a7f2ec037b..038451082eda7d7de181c0e209309f9bfeadfa49 100644
--- a/chrome/browser/extensions/api/tabs/tabs_windows_api.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_windows_api.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/extensions/api/tabs/tabs_windows_api.h"
-#include "chrome/browser/extensions/api/tabs/tabs_windows_api_factory.h"
+#include "base/lazy_instance.h"
#include "chrome/browser/extensions/api/tabs/windows_event_router.h"
#include "chrome/browser/extensions/event_names.h"
#include "chrome/browser/extensions/event_router.h"
@@ -27,7 +27,7 @@ TabsWindowsAPI::~TabsWindowsAPI() {
// static
TabsWindowsAPI* TabsWindowsAPI::Get(Profile* profile) {
- return TabsWindowsAPIFactory::GetForProfile(profile);
+ return ProfileKeyedAPIFactory<TabsWindowsAPI>::GetForProfile(profile);
}
WindowsEventRouter* TabsWindowsAPI::windows_event_router() {
@@ -46,4 +46,13 @@ void TabsWindowsAPI::OnListenerAdded(
ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
}
+static base::LazyInstance<ProfileKeyedAPIFactory<TabsWindowsAPI> >
+g_factory = LAZY_INSTANCE_INITIALIZER;
+
+template <>
+ProfileKeyedAPIFactory<TabsWindowsAPI>*
+ProfileKeyedAPIFactory<TabsWindowsAPI>::GetInstance() {
+ return &g_factory.Get();
+}
+
} // namespace extensions
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_windows_api.h ('k') | chrome/browser/extensions/api/tabs/tabs_windows_api_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698