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

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: Clarify and test Origin.empty_. Created 4 years, 10 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 b5f409e4accbf02adb278c330c12f5b82809b7af..9f12a01572a133b3c6de292ef3b834faa9353b48 100644
--- a/chrome/browser/push_messaging/push_messaging_service_impl.cc
+++ b/chrome/browser/push_messaging/push_messaging_service_impl.cc
@@ -45,6 +45,7 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/push_messaging_status.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, sender_id,
callback));
@@ -429,8 +430,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