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

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: . 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
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | chrome/browser/extensions/extension_info_map.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 727c95309ce95d8751018763648bfab30bea4e3c..1fd4b3f76f3a14fef4da63c7ba9297eb30523b87 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -764,23 +764,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;
}
@@ -826,19 +827,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;
}
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | chrome/browser/extensions/extension_info_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698