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

Unified Diff: chrome/browser/push_messaging/push_messaging_service_impl.cc

Issue 1726323002: Have Permission{Manager,Service} use Origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 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
Index: chrome/browser/push_messaging/push_messaging_service_impl.cc
diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.cc b/chrome/browser/push_messaging/push_messaging_service_impl.cc
index 7e75439d228b65319c6de5fda97133b2ebeeb3fc..1c765d4c3a7539a487b1360c1717eb891e6d52ed 100644
--- a/chrome/browser/push_messaging/push_messaging_service_impl.cc
+++ b/chrome/browser/push_messaging/push_messaging_service_impl.cc
@@ -46,6 +46,7 @@
#include "content/public/common/push_messaging_status.h"
#include "content/public/common/push_subscription_options.h"
#include "ui/base/l10n/l10n_util.h"
+#include "url/origin.h"
#if BUILDFLAG(ENABLE_BACKGROUND)
#include "chrome/browser/background/background_mode_manager.h"
@@ -379,7 +380,7 @@ void PushMessagingServiceImpl::SubscribeFromDocument(
// Push does not allow permission requests from iframes.
profile_->GetPermissionManager()->RequestPermission(
content::PermissionType::PUSH_MESSAGING, web_contents->GetMainFrame(),
- requesting_origin,
+ url::Origin(requesting_origin),
base::Bind(&PushMessagingServiceImpl::DidRequestPermission,
weak_factory_.GetWeakPtr(), app_identifier, options,
callback));
@@ -428,8 +429,9 @@ blink::WebPushPermissionStatus PushMessagingServiceImpl::GetPermissionStatus(
// Because the Push API is tied to Service Workers, many usages of the API
// won't have an embedding origin at all. Only consider the requesting
// |origin| when checking whether permission to use the API has been granted.
+ url::Origin actual_origin(origin);
return ToPushPermission(profile_->GetPermissionManager()->GetPermissionStatus(
- content::PermissionType::PUSH_MESSAGING, origin, origin));
+ content::PermissionType::PUSH_MESSAGING, actual_origin, actual_origin));
}
bool PushMessagingServiceImpl::SupportNonVisibleMessages() {

Powered by Google App Engine
This is Rietveld 408576698