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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 8312005: Ignore paths when matching patterns for extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix silly typo. 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/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index d1651a8426be543a8e3e3ac0e63640e52df161ff..bdc5c32297f529c84a09127942dd9808dec8f03c 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -762,23 +762,24 @@ void ChromeContentBrowserClient::RequestDesktopNotificationPermission(
WebKit::WebNotificationPresenter::Permission
ChromeContentBrowserClient::CheckDesktopNotificationPermission(
- const GURL& source_url,
- const content::ResourceContext& context) {
+ const GURL& source_origin,
+ const content::ResourceContext& context,
+ int render_process_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
ProfileIOData* io_data =
reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
- const Extension* extension =
- io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url);
- if (extension &&
- extension->HasAPIPermission(ExtensionAPIPermission::kNotification)) {
+ if (io_data->GetExtensionInfoMap()->SecurityOriginHasAPIPermission(
+ source_origin, render_process_id,
+ ExtensionAPIPermission::kNotification))
return WebKit::WebNotificationPresenter::PermissionAllowed;
- }
// Fall back to the regular notification preferences, which works on an
// origin basis.
+ // TODO(dcheng): Change to just source_origin once WebKit side is cleaned up.
return io_data->GetNotificationService() ?
- io_data->GetNotificationService()->HasPermission(source_url.GetOrigin()) :
+ io_data->GetNotificationService()->HasPermission(
+ source_origin.GetOrigin()) :
WebKit::WebNotificationPresenter::PermissionNotAllowed;
}
@@ -824,19 +825,18 @@ void ChromeContentBrowserClient::CancelDesktopNotification(
}
bool ChromeContentBrowserClient::CanCreateWindow(
- const GURL& source_url,
+ const GURL& source_origin,
WindowContainerType container_type,
- const content::ResourceContext& context) {
+ const content::ResourceContext& context,
+ int render_process_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
// If the opener is trying to create a background window but doesn't have
// the appropriate permission, fail the attempt.
if (container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) {
ProfileIOData* io_data =
reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
- const Extension* extension =
- io_data->GetExtensionInfoMap()->extensions().GetByURL(source_url);
- return (extension &&
- extension->HasAPIPermission(ExtensionAPIPermission::kBackground));
+ return io_data->GetExtensionInfoMap()->SecurityOriginHasAPIPermission(
+ source_origin, render_process_id, ExtensionAPIPermission::kBackground);
}
return true;
}

Powered by Google App Engine
This is Rietveld 408576698