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

Unified Diff: chrome/browser/renderer_host/chrome_render_message_filter.cc

Issue 8312005: Ignore paths when matching patterns for extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 2 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/renderer_host/chrome_render_message_filter.cc
diff --git a/chrome/browser/renderer_host/chrome_render_message_filter.cc b/chrome/browser/renderer_host/chrome_render_message_filter.cc
index ce27cd4cf351bad4da6206568c4bbb44f7e953d4..cb13226329bef0e79e27f1541bcb7dd1b424e1d4 100644
--- a/chrome/browser/renderer_host/chrome_render_message_filter.cc
+++ b/chrome/browser/renderer_host/chrome_render_message_filter.cc
@@ -590,23 +590,29 @@ void ChromeRenderMessageFilter::GetPluginInfo(
status->value = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed;
}
-void ChromeRenderMessageFilter::OnCanTriggerClipboardRead(const GURL& url,
- bool* allowed) {
- const Extension* extension =
- extension_info_map_->extensions().GetByURL(url);
- *allowed = extension &&
- extension->HasAPIPermission(ExtensionAPIPermission::kClipboardRead);
+void ChromeRenderMessageFilter::OnCanTriggerClipboardRead(
+ const std::string& origin, bool* allowed) {
+ // TODO(dcheng): It'd be nice to consolidate these two checks together...?
+ *allowed = extension_info_map_->extensions().SecurityOriginHasAPIPermission(
+ origin, ExtensionAPIPermission::kClipboardRead) &&
+ extension_info_map_->AreBindingsEnabledForProcess(render_process_id_);
}
-void ChromeRenderMessageFilter::OnCanTriggerClipboardWrite(const GURL& url,
- bool* allowed) {
+void ChromeRenderMessageFilter::OnCanTriggerClipboardWrite(
+ const std::string& origin, bool* allowed) {
// Since all extensions could historically write to the clipboard, preserve it
// for compatibility.
- const Extension* extension =
- extension_info_map_->extensions().GetByURL(url);
- *allowed = url.SchemeIs(chrome::kExtensionScheme) ||
- (extension &&
- extension->HasAPIPermission(ExtensionAPIPermission::kClipboardWrite));
+ // TODO(dcheng): Where is the right place to convert to a URL? Ideally, we'd
Aaron Boodman 2011/10/20 06:53:51 I think in general, in Chrome, if we have a URL (o
+ // convert in one place. Most callers will have the origin as a string.
+ // However, because of the special exception for clipboardWrite we need to
+ // URL-ize the origin here as well. The alternative is to check that the
+ // chrome extension schema is a prefix of the origin, but that seems like
+ // somewhat of a hack...
+ GURL origin_as_url(origin);
+ *allowed = (origin_as_url.SchemeIs(chrome::kExtensionScheme) ||
+ extension_info_map_->extensions().SecurityOriginHasAPIPermission(
+ origin, ExtensionAPIPermission::kClipboardWrite)) &&
+ extension_info_map_->AreBindingsEnabledForProcess(render_process_id_);
}
void ChromeRenderMessageFilter::OnGetCookies(

Powered by Google App Engine
This is Rietveld 408576698