summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_dom_ui.h
diff options
context:
space:
mode:
authorerikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-28 20:26:05 +0000
committererikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-28 20:26:05 +0000
commit86c008e8a7da9c00c5a676eb201ba5d0c976748e (patch)
tree8e58aeeab8564a396ccf67807d5bddfcdaa05807 /chrome/browser/extensions/extension_dom_ui.h
parent5ec8d59c7e79d1a7aae4137051ffc184ec51096c (diff)
downloadchromium_src-86c008e8a7da9c00c5a676eb201ba5d0c976748e.zip
chromium_src-86c008e8a7da9c00c5a676eb201ba5d0c976748e.tar.gz
chromium_src-86c008e8a7da9c00c5a676eb201ba5d0c976748e.tar.bz2
override chrome:// URLs via extensions.
Overrides are declared in an extension's manifest. The last one installed wins. However, we keep a list of those installed per page so that priority is preserved and so that uninstall will revert to a previous state. Review URL: http://codereview.chromium.org/174277 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24791 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_dom_ui.h')
-rw-r--r--chrome/browser/extensions/extension_dom_ui.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_dom_ui.h b/chrome/browser/extensions/extension_dom_ui.h
index ff64a9d..b8ef8dc 100644
--- a/chrome/browser/extensions/extension_dom_ui.h
+++ b/chrome/browser/extensions/extension_dom_ui.h
@@ -9,6 +9,10 @@
#include "chrome/browser/dom_ui/dom_ui.h"
#include "chrome/browser/extensions/extension_function_dispatcher.h"
+class ListValue;
+class PrefService;
+class TabContents;
+
// This class implements DOMUI for extensions and allows extensions to put UI in
// the main tab contents area.
class ExtensionDOMUI
@@ -16,6 +20,7 @@ class ExtensionDOMUI
public ExtensionFunctionDispatcher::Delegate {
public:
explicit ExtensionDOMUI(TabContents* tab_contents);
+
ExtensionFunctionDispatcher* extension_function_dispatcher() const {
return extension_function_dispatcher_.get();
}
@@ -31,7 +36,36 @@ class ExtensionDOMUI
// ExtensionFunctionDispatcher::Delegate
virtual Browser* GetBrowser();
+ // BrowserURLHandler
+ static bool HandleChromeURLOverride(GURL* url, Profile* profile);
+
+ // Register and unregister a dictionary of one or more overrides.
+ // Page names are the keys, and chrome-extension: URLs are the values.
+ // (e.g. { "newtab": "chrome-extension://<id>/my_new_tab.html" }
+ static void RegisterChromeURLOverrides(Profile* profile,
+ const DictionaryValue* overrides);
+ static void UnregisterChromeURLOverrides(Profile* profile,
+ const DictionaryValue* overrides);
+ static void UnregisterChromeURLOverride(const std::string& page,
+ Profile* profile,
+ Value* override);
+
+ // Called from BrowserPrefs
+ static void RegisterUserPrefs(PrefService* prefs);
+
private:
+ // Unregister the specified override, and if it's the currently active one,
+ // ensure that something takes its place.
+ static void UnregisterAndReplaceOverride(const std::string& page,
+ Profile* profile,
+ ListValue* list,
+ Value* override);
+
+ // When the RenderViewHost changes (RenderViewCreated and RenderViewReused),
+ // we need to reset the ExtensionFunctionDispatcher so it's talking to the
+ // right one, as well as being linked to the correct URL.
+ void ResetExtensionFunctionDispatcher(RenderViewHost* render_view_host);
+
scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_;
};