summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/api_function.h
diff options
context:
space:
mode:
authormiket@chromium.org <miket@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-20 01:22:06 +0000
committermiket@chromium.org <miket@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-20 01:22:06 +0000
commit931186e0b13b853f871b9c03e8f589ca8aa930b2 (patch)
tree3d4296dec5faedbfe0039ae12ac529eb631633fc /chrome/browser/extensions/api/api_function.h
parentcdf68094a5f12691d5cfc3e4135787e45a16795a (diff)
downloadchromium_src-931186e0b13b853f871b9c03e8f589ca8aa930b2.zip
chromium_src-931186e0b13b853f871b9c03e8f589ca8aa930b2.tar.gz
chromium_src-931186e0b13b853f871b9c03e8f589ca8aa930b2.tar.bz2
Refactored away the abomination of poor object-oriented design that was APIResourceController.
- Removed APIResourceController from ExtensionService. - Conformed "API" capitalization to match style guide. - Introduced ApiResourceManager as the successor to APIResourceController. Each instance knows about exactly one ApiResource type, which allows us to avoid the horrible circular dependencies and static_casts<> of APIResourceController. - Made each ApiResourceManager a ProfileKeyedService so that it's clearer that they're bound to a single Profile. I didn't see any benefit to moving the resource destructors to PKS's Shutdown method, so I didn't do that. RECOMMENDED METHOD OF CONSUMPTION OF THIS CHANGELIST FOR MAXIMUM ENJOYMENT: 1. Understand what APIResourceController was trying to do. 2. See that APIResourceController is now gone. 3. Review the new ApiResourceManager template. 4. Confirm that all usage of APIRC is replaced with ApiRM<> usage. 5. Scan the remainder for API -> Api changes. BUG=112902 TEST=updated Review URL: https://chromiumcodereview.appspot.com/10777003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147589 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/api/api_function.h')
-rw-r--r--chrome/browser/extensions/api/api_function.h27
1 files changed, 11 insertions, 16 deletions
diff --git a/chrome/browser/extensions/api/api_function.h b/chrome/browser/extensions/api/api_function.h
index 2a91e30..eda006c 100644
--- a/chrome/browser/extensions/api/api_function.h
+++ b/chrome/browser/extensions/api/api_function.h
@@ -6,22 +6,22 @@
#define CHROME_BROWSER_EXTENSIONS_API_API_FUNCTION_H_
#include "chrome/browser/extensions/extension_function.h"
-#include "chrome/browser/extensions/api/api_resource.h"
#include "content/public/browser/browser_thread.h"
-class ExtensionService;
-
namespace extensions {
-class APIResourceController;
-class APIResourceEventNotifier;
+class ApiResourceEventNotifier;
-// AsyncAPIFunction provides convenient thread management for APIs that need to
+// AsyncApiFunction provides convenient thread management for APIs that need to
// do essentially all their work on a thread other than the UI thread.
-class AsyncAPIFunction : public AsyncExtensionFunction {
+class AsyncApiFunction : public AsyncExtensionFunction {
protected:
- AsyncAPIFunction();
- virtual ~AsyncAPIFunction() {}
+ AsyncApiFunction();
+ virtual ~AsyncApiFunction() {}
+
+ // Like Prepare(). A useful place to put common work in an ApiFunction
+ // superclass that multiple API functions want to share.
+ virtual bool PrePrepare();
// Set up for work (e.g., validate arguments). Guaranteed to happen on UI
// thread.
@@ -34,7 +34,7 @@ class AsyncAPIFunction : public AsyncExtensionFunction {
// Start the asynchronous work. Guraranteed to happen on requested thread.
virtual void AsyncWorkStart();
- // Notify AsyncIOAPIFunction that the work is completed
+ // Notify AsyncIOApiFunction that the work is completed
void AsyncWorkCompleted();
// Respond. Guaranteed to happen on UI thread.
@@ -51,10 +51,7 @@ class AsyncAPIFunction : public AsyncExtensionFunction {
int DeprecatedExtractSrcId(size_t argument_position);
// Utility.
- APIResourceEventNotifier* CreateEventNotifier(int src_id);
-
- // Access to the controller singleton.
- APIResourceController* controller();
+ ApiResourceEventNotifier* CreateEventNotifier(int src_id);
// ExtensionFunction::RunImpl()
virtual bool RunImpl() OVERRIDE;
@@ -71,8 +68,6 @@ class AsyncAPIFunction : public AsyncExtensionFunction {
// If you don't want your Work() method to happen on the IO thread, then set
// this to the thread that you do want, preferably in Prepare().
content::BrowserThread::ID work_thread_id_;
-
- ExtensionService* extension_service_;
};
} // namespace extensions