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

Unified Diff: content/renderer/push_messaging/push_messaging_client.cc

Issue 2935333003: Propagate the user gesture bit when requesting push messaging permission. (Closed)
Patch Set: ThreadSafe user gesture check Created 3 years, 6 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: content/renderer/push_messaging/push_messaging_client.cc
diff --git a/content/renderer/push_messaging/push_messaging_client.cc b/content/renderer/push_messaging/push_messaging_client.cc
index ab44099a866fad5f378c9e0c28a70c68168093d3..51785ca61e13b1fd2bba7aac1cab91c8cf30995c 100644
--- a/content/renderer/push_messaging/push_messaging_client.cc
+++ b/content/renderer/push_messaging/push_messaging_client.cc
@@ -46,6 +46,7 @@ void PushMessagingClient::OnDestruct() {
void PushMessagingClient::Subscribe(
blink::WebServiceWorkerRegistration* service_worker_registration,
const blink::WebPushSubscriptionOptions& options,
+ bool user_gesture,
std::unique_ptr<blink::WebPushSubscriptionCallbacks> callbacks) {
DCHECK(service_worker_registration);
DCHECK(callbacks);
@@ -55,16 +56,17 @@ void PushMessagingClient::Subscribe(
if (options.application_server_key.IsEmpty()) {
RenderFrameImpl::FromRoutingID(routing_id())
->manifest_manager()
- ->GetManifest(base::Bind(
- &PushMessagingClient::DidGetManifest, base::Unretained(this),
- service_worker_registration, options, base::Passed(&callbacks)));
+ ->GetManifest(base::Bind(&PushMessagingClient::DidGetManifest,
+ base::Unretained(this),
+ service_worker_registration, options,
+ user_gesture, base::Passed(&callbacks)));
} else {
PushSubscriptionOptions content_options;
content_options.user_visible_only = options.user_visible_only;
// Just treat the server key as a string of bytes and pass it to the push
// service.
content_options.sender_info = options.application_server_key.Latin1();
- DoSubscribe(service_worker_registration, content_options,
+ DoSubscribe(service_worker_registration, content_options, user_gesture,
std::move(callbacks));
}
}
@@ -72,6 +74,7 @@ void PushMessagingClient::Subscribe(
void PushMessagingClient::DidGetManifest(
blink::WebServiceWorkerRegistration* service_worker_registration,
const blink::WebPushSubscriptionOptions& options,
+ bool user_gesture,
std::unique_ptr<blink::WebPushSubscriptionCallbacks> callbacks,
const GURL& manifest_url,
const Manifest& manifest,
@@ -92,13 +95,14 @@ void PushMessagingClient::DidGetManifest(
base::UTF16ToUTF8(manifest.gcm_sender_id.string());
}
- DoSubscribe(service_worker_registration, content_options,
+ DoSubscribe(service_worker_registration, content_options, user_gesture,
std::move(callbacks));
}
void PushMessagingClient::DoSubscribe(
blink::WebServiceWorkerRegistration* service_worker_registration,
const PushSubscriptionOptions& options,
+ bool user_gesture,
std::unique_ptr<blink::WebPushSubscriptionCallbacks> callbacks) {
int64_t service_worker_registration_id =
static_cast<WebServiceWorkerRegistrationImpl*>(
@@ -113,7 +117,7 @@ void PushMessagingClient::DoSubscribe(
DCHECK(push_messaging_manager_);
push_messaging_manager_->Subscribe(
- routing_id(), service_worker_registration_id, options,
+ routing_id(), service_worker_registration_id, options, user_gesture,
// Safe to use base::Unretained because |push_messaging_manager_ |is
// owned by |this|.
base::Bind(&PushMessagingClient::DidSubscribe, base::Unretained(this),

Powered by Google App Engine
This is Rietveld 408576698