diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-15 22:58:33 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-15 22:58:33 +0000 |
commit | b83e4600fc1c2f1c42598f8d89dbd36d9415309d (patch) | |
tree | 4b2ee497813a59a91105f91f6a5329224da18eac /chrome/browser/extensions/extension_function_dispatcher.h | |
parent | a9a2668386addfa40ff262005d396468f54b99e2 (diff) | |
download | chromium_src-b83e4600fc1c2f1c42598f8d89dbd36d9415309d.zip chromium_src-b83e4600fc1c2f1c42598f8d89dbd36d9415309d.tar.gz chromium_src-b83e4600fc1c2f1c42598f8d89dbd36d9415309d.tar.bz2 |
First step to enable end-to-end testing of extensions through the
automation interface. This adds a method to turn on automation of
extension API functions, plumbing that redirects API requests
through the automation interface when appropriate, and a couple
of UITests that exercise the functionality.
See http://codereview.chromium.org/113277 for the original review.
Review URL: http://codereview.chromium.org/115427
Patch from Joi Sigurdsson <joi.sigurdsson@gmail.com>.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16207 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_function_dispatcher.h')
-rw-r--r-- | chrome/browser/extensions/extension_function_dispatcher.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_function_dispatcher.h b/chrome/browser/extensions/extension_function_dispatcher.h index fed54791..a9af552 100644 --- a/chrome/browser/extensions/extension_function_dispatcher.h +++ b/chrome/browser/extensions/extension_function_dispatcher.h @@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ +#include <map> #include <string> #include <vector> @@ -16,6 +17,9 @@ class Profile; class RenderViewHost; class RenderViewHostDelegate; +// A factory function for creating new ExtensionFunction instances. +typedef ExtensionFunction* (*ExtensionFunctionFactory)(); + // ExtensionFunctionDispatcher receives requests to execute functions from // Chromium extensions running in a RenderViewHost and dispatches them to the // appropriate handler. It lives entirely on the UI thread. @@ -29,6 +33,14 @@ class ExtensionFunctionDispatcher { // Gets a list of all known extension function names. static void GetAllFunctionNames(std::vector<std::string>* names); + // Override a previously registered function. Returns true if successful, + // false if no such function was registered. + static bool OverrideFunction(const std::string& name, + ExtensionFunctionFactory factory); + + // Resets all functions to their initial implementation. + static void ResetFunctions(); + ExtensionFunctionDispatcher(RenderViewHost* render_view_host, Delegate* delegate, const std::string& extension_id); @@ -60,6 +72,13 @@ class ExtensionFunctionDispatcher { Delegate* delegate_; std::string extension_id_; + + // AutomationExtensionFunction requires access to the RenderViewHost + // associated with us. We make it a friend rather than exposing the + // RenderViewHost as a public method as we wouldn't want everyone to + // start assuming a 1:1 relationship between us and RenderViewHost, + // whereas AutomationExtensionFunction is by necessity "tight" with us. + friend class AutomationExtensionFunction; }; #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ |