Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Unified Diff: chrome/browser/extensions/extension_dom_ui.cc

Issue 3263007: Reland r57788 - Expose Extension Bindings to Component Applications (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: don't hide gallery url in omnibar Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_dom_ui.cc
diff --git a/chrome/browser/extensions/extension_dom_ui.cc b/chrome/browser/extensions/extension_dom_ui.cc
index 13153306b94cbecf12e3aa0ab350d1f590388a54..62cfee0064ef31c8babd35deddd66d718a35d351 100644
--- a/chrome/browser/extensions/extension_dom_ui.cc
+++ b/chrome/browser/extensions/extension_dom_ui.cc
@@ -120,18 +120,26 @@ class ExtensionDOMUIImageLoadingTracker : public ImageLoadingTracker::Observer {
const char ExtensionDOMUI::kExtensionURLOverrides[] =
"extensions.chrome_url_overrides";
-ExtensionDOMUI::ExtensionDOMUI(TabContents* tab_contents)
+ExtensionDOMUI::ExtensionDOMUI(TabContents* tab_contents, GURL url)
: DOMUI(tab_contents) {
- should_hide_url_ = true;
+ ExtensionsService* service = tab_contents->profile()->GetExtensionsService();
+ Extension* extension = service->GetExtensionByURL(url);
+ if (!extension)
+ extension = service->GetExtensionByWebExtent(url);
+ DCHECK(extension);
+ // Only hide the url for internal pages (e.g. chrome-extension or packaged
+ // component apps like bookmark manager.
+ should_hide_url_ = !extension->is_app();
+
bindings_ = BindingsPolicy::EXTENSION;
// Bind externalHost to Extension DOMUI loaded in Chrome Frame.
const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
if (browser_command_line.HasSwitch(switches::kChromeFrame))
bindings_ |= BindingsPolicy::EXTERNAL_HOST;
// For chrome:// overrides, some of the defaults are a little different.
- GURL url = tab_contents->GetURL();
- if (url.SchemeIs(chrome::kChromeUIScheme) &&
- url.host() == chrome::kChromeUINewTabHost) {
+ GURL effective_url = tab_contents->GetURL();
+ if (effective_url.SchemeIs(chrome::kChromeUIScheme) &&
+ effective_url.host() == chrome::kChromeUINewTabHost) {
focus_location_bar_by_default_ = true;
}
}
« no previous file with comments | « chrome/browser/extensions/extension_dom_ui.h ('k') | chrome/browser/extensions/extension_function_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698