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

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

Issue 1383001: Hook up extension apps notification permission, take two (Closed)
Patch Set: pre commit Created 10 years, 9 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/renderer_host/resource_message_filter.h ('k') | chrome/common/render_messages_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/resource_message_filter.cc
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index 3dfcf63a928e5243ac3225f3feea51b90e4d7e71..cb65791f4da46d4b1644c7418a0bcb81436be101 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -922,18 +922,26 @@ void ResourceMessageFilter::OnClipboardReadHTML(Clipboard::Buffer buffer,
#endif
void ResourceMessageFilter::OnCheckNotificationPermission(
- const GURL& source_url, const std::string& application_id, int* result) {
+ const GURL& source_url, int* result) {
+ *result = WebKit::WebNotificationPresenter::PermissionNotAllowed;
+
ChromeURLRequestContext* context = GetRequestContextForURL(source_url);
- if (!application_id.empty() &&
- context->CheckURLAccessToExtensionPermission(
- source_url, application_id, Extension::kNotificationPermission)) {
+ if (context->CheckURLAccessToExtensionPermission(source_url,
+ Extension::kNotificationPermission)) {
*result = WebKit::WebNotificationPresenter::PermissionAllowed;
return;
}
// Fall back to the regular notification preferences, which works on an
// origin basis.
- *result = notification_prefs_->HasPermission(source_url.GetOrigin());
+ // Note: An earlier implemention of checking the notification permission for
+ // extensions persisted the permission in the preferences. To avoid
+ // erroneously granting permission to an extension that has since been removed
+ // from the preferences, we only check for non-extension schemes. All
+ // extension cases (chrome-extension and web-content) are now handled by
+ // the above call to CheckURLAccessToExtensionPermission.
+ if (!source_url.SchemeIs(chrome::kExtensionScheme))
+ *result = notification_prefs_->HasPermission(source_url.GetOrigin());
}
void ResourceMessageFilter::OnGetMimeTypeFromExtension(
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter.h ('k') | chrome/common/render_messages_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698