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

Unified Diff: chrome/browser/extensions/api/processes/processes_api.h

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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/processes/processes_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/processes/processes_api.h
diff --git a/chrome/browser/extensions/api/processes/processes_api.h b/chrome/browser/extensions/api/processes/processes_api.h
index a6b6d3527891933cdd2be4b4b6b293cb4e912195..a39fc1ca27013c203342a8aa8b7116c52d97481b 100644
--- a/chrome/browser/extensions/api/processes/processes_api.h
+++ b/chrome/browser/extensions/api/processes/processes_api.h
@@ -9,6 +9,7 @@
#include <string>
#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
#include "chrome/browser/extensions/event_router.h"
#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/profiles/profile_keyed_service.h"
@@ -91,7 +92,7 @@ class ProcessesEventRouter : public TaskManagerModelObserver,
};
// The profile-keyed service that manages the processes extension API.
-class ProcessesAPI : public ProfileKeyedService,
+class ProcessesAPI : public ProfileKeyedAPI,
public EventRouter::Observer {
public:
explicit ProcessesAPI(Profile* profile);
@@ -110,12 +111,25 @@ class ProcessesAPI : public ProfileKeyedService,
virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE;
private:
+ friend class ProfileKeyedAPIFactory<ProcessesAPI>;
+
Profile* profile_;
+ // ProfileKeyedAPI implementation.
+ static const char* service_name() {
+ return "ProcessesAPI";
+ }
+ static const bool kServiceRedirectedInIncognito = true;
+ static const bool kServiceIsNULLWhileTesting = true;
+
// Created lazily on first access.
scoped_ptr<ProcessesEventRouter> processes_event_router_;
};
+template <>
+ProfileKeyedAPIFactory<ProcessesAPI>*
+ProfileKeyedAPIFactory<ProcessesAPI>::GetInstance();
+
// This extension function returns the Process object for the renderer process
// currently in use by the specified Tab.
class GetProcessIdForTabFunction : public AsyncExtensionFunction,
« no previous file with comments | « no previous file | chrome/browser/extensions/api/processes/processes_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698