diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-24 22:02:19 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-24 22:02:19 +0000 |
commit | c2732efe31f3ed2cefd9ef8ab35c71aed97d0a98 (patch) | |
tree | 8e57ebacf09b7a9fa4819b115fe7c7d0ca0a864b /chrome/browser/extensions | |
parent | 2c533896e85de3047519c4890f6b22e824d77669 (diff) | |
download | chromium_src-c2732efe31f3ed2cefd9ef8ab35c71aed97d0a98.zip chromium_src-c2732efe31f3ed2cefd9ef8ab35c71aed97d0a98.tar.gz chromium_src-c2732efe31f3ed2cefd9ef8ab35c71aed97d0a98.tar.bz2 |
Pass the ExtensionID to the ExtensionFunctionDispatcher.
This is needed for PageActions that deal with IDs, so
that we can check if one PageAction is trying to change
another PageAction. This converts the object
ExtensionFunctionDispatcher in RenderViewHost from a
member to a scoped ptr so we can reset it on navigate.
BUG=None
TEST=Extensions should work as before (no visible
change).
Review URL: http://codereview.chromium.org/93125
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14481 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
4 files changed, 18 insertions, 4 deletions
diff --git a/chrome/browser/extensions/extension_function.cc b/chrome/browser/extensions/extension_function.cc index 8de21df..6b22998 100644 --- a/chrome/browser/extensions/extension_function.cc +++ b/chrome/browser/extensions/extension_function.cc @@ -21,6 +21,10 @@ void ExtensionFunction::SendResponse(bool success) { } } +std::string ExtensionFunction::extension_id() { + return dispatcher_->extension_id(); +} + Profile* ExtensionFunction::profile() { return dispatcher_->profile(); } diff --git a/chrome/browser/extensions/extension_function.h b/chrome/browser/extensions/extension_function.h index ed8fe9e..cc1d049 100644 --- a/chrome/browser/extensions/extension_function.h +++ b/chrome/browser/extensions/extension_function.h @@ -52,6 +52,8 @@ class ExtensionFunction { protected: void SendResponse(bool success); + std::string extension_id(); + Profile* profile(); // The arguments to the API. Only non-null if argument were specfied. diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc index 195b99e..56a4f61 100644 --- a/chrome/browser/extensions/extension_function_dispatcher.cc +++ b/chrome/browser/extensions/extension_function_dispatcher.cc @@ -96,8 +96,11 @@ void ExtensionFunctionDispatcher::GetAllFunctionNames( }
ExtensionFunctionDispatcher::ExtensionFunctionDispatcher(
- RenderViewHost* render_view_host)
- : render_view_host_(render_view_host) {}
+ RenderViewHost* render_view_host,
+ const std::string& extension_id)
+ : render_view_host_(render_view_host),
+ extension_id_(extension_id) {
+}
void ExtensionFunctionDispatcher::HandleRequest(const std::string& name,
const std::string& args,
@@ -151,4 +154,3 @@ void ExtensionFunctionDispatcher::HandleBadMessage(ExtensionFunction* api) { Profile* ExtensionFunctionDispatcher::profile() {
return render_view_host_->process()->profile();
}
-
diff --git a/chrome/browser/extensions/extension_function_dispatcher.h b/chrome/browser/extensions/extension_function_dispatcher.h index 13057d8..ab3a07d 100644 --- a/chrome/browser/extensions/extension_function_dispatcher.h +++ b/chrome/browser/extensions/extension_function_dispatcher.h @@ -22,7 +22,8 @@ class ExtensionFunctionDispatcher { // Gets a list of all known extension function names. static void GetAllFunctionNames(std::vector<std::string>* names); - ExtensionFunctionDispatcher(RenderViewHost* render_view_host); + ExtensionFunctionDispatcher(RenderViewHost* render_view_host, + const std::string& extension_id); // Handle a request to execute an extension function. void HandleRequest(const std::string& name, const std::string& args, @@ -35,11 +36,16 @@ class ExtensionFunctionDispatcher { // the renderer. void HandleBadMessage(ExtensionFunction* api); + // Gets the ID for this extension. + std::string extension_id() { return extension_id_; } + // The profile that this dispatcher is associated with. Profile* profile(); private: RenderViewHost* render_view_host_; + + std::string extension_id_; }; #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ |