summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_function_dispatcher.h
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-07 21:44:12 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-07 21:44:12 +0000
commit7eecaed5a8494e513676c0e1e109192bb20fbc39 (patch)
tree33f724a08a8c96e16fbcca2b0074bcad69396b76 /chrome/browser/extensions/extension_function_dispatcher.h
parent0dc58a4fd486067f250e3ebf7e9ed8521db39cd8 (diff)
downloadchromium_src-7eecaed5a8494e513676c0e1e109192bb20fbc39.zip
chromium_src-7eecaed5a8494e513676c0e1e109192bb20fbc39.tar.gz
chromium_src-7eecaed5a8494e513676c0e1e109192bb20fbc39.tar.bz2
Make background pages work more nicely with the tabs API.
Changed ExtensionHost so that it returns NULL if it doesn't have a browser, instead of getting the last active one. The problem is that if ExtensionHost returns the last active browser at the time it's constructed, it might be garbage by the time it is used. Changed tab functions to use more consistent logic to determine the 'current' browser to operate on. Review URL: http://codereview.chromium.org/115071 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15587 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_function_dispatcher.h')
-rw-r--r--chrome/browser/extensions/extension_function_dispatcher.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/chrome/browser/extensions/extension_function_dispatcher.h b/chrome/browser/extensions/extension_function_dispatcher.h
index 1ffb3d4..43d2a36 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.h
+++ b/chrome/browser/extensions/extension_function_dispatcher.h
@@ -21,11 +21,16 @@ class RenderViewHostDelegate;
// appropriate handler. It lives entirely on the UI thread.
class ExtensionFunctionDispatcher {
public:
+ class Delegate {
+ public:
+ virtual Browser* GetBrowser() = 0;
+ };
+
// Gets a list of all known extension function names.
static void GetAllFunctionNames(std::vector<std::string>* names);
ExtensionFunctionDispatcher(RenderViewHost* render_view_host,
- Browser* browser,
+ Delegate* delegate,
const std::string& extension_id);
// Handle a request to execute an extension function.
@@ -35,7 +40,9 @@ class ExtensionFunctionDispatcher {
// Send a response to a function.
void SendResponse(ExtensionFunction* api);
- Browser* browser() { return browser_; }
+ // Gets the browser extension functions should operate relative to. For
+ // example, for positioning windows, or alert boxes, or creating tabs.
+ Browser* GetBrowser();
// Handle a malformed message. Possibly the result of an attack, so kill
// the renderer.
@@ -50,7 +57,7 @@ class ExtensionFunctionDispatcher {
private:
RenderViewHost* render_view_host_;
- Browser* browser_;
+ Delegate* delegate_;
std::string extension_id_;
};