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

Unified Diff: chrome/renderer/extensions/extension_renderer_info.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
« no previous file with comments | « chrome/renderer/extensions/extension_renderer_info.h ('k') | chrome/renderer/mock_render_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/extension_renderer_info.cc
diff --git a/chrome/renderer/extensions/extension_renderer_info.cc b/chrome/renderer/extensions/extension_renderer_info.cc
index 9abd4f545496cb6291ec9220b85095da92a90a8d..f4b61a1b3d4865389e038739585573b149cf2ef7 100644
--- a/chrome/renderer/extensions/extension_renderer_info.cc
+++ b/chrome/renderer/extensions/extension_renderer_info.cc
@@ -29,6 +29,7 @@ void ExtensionRendererInfo::Update(const ViewMsg_ExtensionRendererInfo& info) {
id_ = info.id;
web_extent_ = info.web_extent;
name_ = info.name;
+ location_ = info.location;
icon_url_ = info.icon_url;
}
@@ -46,6 +47,18 @@ void ExtensionRendererInfo::UpdateExtensions(
}
// static
+std::string ExtensionRendererInfo::GetIdByURL(const GURL& url) {
+ if (url.SchemeIs(chrome::kExtensionScheme))
+ return url.host();
+
+ ExtensionRendererInfo* info = GetByURL(url);
+ if (!info)
+ return "";
+
+ return info->id();
+}
+
+// static
ExtensionRendererInfo* ExtensionRendererInfo::GetByURL(const GURL& url) {
if (url.SchemeIs(chrome::kExtensionScheme))
return GetByID(url.host());
@@ -84,3 +97,21 @@ ExtensionRendererInfo* ExtensionRendererInfo::GetByID(
}
return NULL;
}
+
+// static
+bool ExtensionRendererInfo::ExtensionBindingsAllowed(const GURL& url) {
+ if (url.SchemeIs(chrome::kExtensionScheme))
+ return true;
+
+ if (!extensions_)
+ return false;
+
+ std::vector<ExtensionRendererInfo>::iterator i = extensions_->begin();
+ for (; i != extensions_->end(); ++i) {
+ if (i->location_ == Extension::COMPONENT &&
+ i->web_extent_.ContainsURL(url))
+ return true;
+ }
+
+ return false;
+}
« no previous file with comments | « chrome/renderer/extensions/extension_renderer_info.h ('k') | chrome/renderer/mock_render_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698