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

Side by Side Diff: content/renderer/notification_permission_dispatcher.cc

Issue 749213003: Include whether Notification permission was requested with a user gesture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
« no previous file with comments | « content/common/platform_notification_messages.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/notification_permission_dispatcher.h" 5 #include "content/renderer/notification_permission_dispatcher.h"
6 6
7 #include "content/common/platform_notification_messages.h" 7 #include "content/common/platform_notification_messages.h"
8 #include "third_party/WebKit/public/platform/WebString.h" 8 #include "third_party/WebKit/public/platform/WebString.h"
9 #include "third_party/WebKit/public/web/WebNotificationPermissionCallback.h" 9 #include "third_party/WebKit/public/web/WebNotificationPermissionCallback.h"
10 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" 10 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
11 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
11 #include "url/gurl.h" 12 #include "url/gurl.h"
12 13
13 namespace content { 14 namespace content {
14 15
15 NotificationPermissionDispatcher::NotificationPermissionDispatcher( 16 NotificationPermissionDispatcher::NotificationPermissionDispatcher(
16 RenderFrame* render_frame) : RenderFrameObserver(render_frame) { 17 RenderFrame* render_frame) : RenderFrameObserver(render_frame) {
17 } 18 }
18 19
19 NotificationPermissionDispatcher::~NotificationPermissionDispatcher() { 20 NotificationPermissionDispatcher::~NotificationPermissionDispatcher() {
20 } 21 }
21 22
22 void NotificationPermissionDispatcher::RequestPermission( 23 void NotificationPermissionDispatcher::RequestPermission(
23 const blink::WebSecurityOrigin& origin, 24 const blink::WebSecurityOrigin& origin,
24 blink::WebNotificationPermissionCallback* callback) { 25 blink::WebNotificationPermissionCallback* callback) {
25 int request_id = pending_requests_.Add(callback); 26 int request_id = pending_requests_.Add(callback);
26 Send(new PlatformNotificationHostMsg_RequestPermission( 27 Send(new PlatformNotificationHostMsg_RequestPermission(
27 routing_id(), GURL(origin.toString()), request_id)); 28 routing_id(),
29 GURL(origin.toString()),
30 request_id,
31 blink::WebUserGestureIndicator::isProcessingUserGesture()));
28 } 32 }
29 33
30 bool NotificationPermissionDispatcher::OnMessageReceived( 34 bool NotificationPermissionDispatcher::OnMessageReceived(
31 const IPC::Message& message) { 35 const IPC::Message& message) {
32 bool handled = true; 36 bool handled = true;
33 IPC_BEGIN_MESSAGE_MAP(NotificationPermissionDispatcher, message) 37 IPC_BEGIN_MESSAGE_MAP(NotificationPermissionDispatcher, message)
34 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_PermissionRequestComplete, 38 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_PermissionRequestComplete,
35 OnPermissionRequestComplete); 39 OnPermissionRequestComplete);
36 IPC_MESSAGE_UNHANDLED(handled = false) 40 IPC_MESSAGE_UNHANDLED(handled = false)
37 IPC_END_MESSAGE_MAP() 41 IPC_END_MESSAGE_MAP()
38 42
39 return handled; 43 return handled;
40 } 44 }
41 45
42 void NotificationPermissionDispatcher::OnPermissionRequestComplete( 46 void NotificationPermissionDispatcher::OnPermissionRequestComplete(
43 int request_id, blink::WebNotificationPermission result) { 47 int request_id, blink::WebNotificationPermission result) {
44 blink::WebNotificationPermissionCallback* callback = 48 blink::WebNotificationPermissionCallback* callback =
45 pending_requests_.Lookup(request_id); 49 pending_requests_.Lookup(request_id);
46 DCHECK(callback); 50 DCHECK(callback);
47 51
48 callback->permissionRequestComplete(result); 52 callback->permissionRequestComplete(result);
49 pending_requests_.Remove(request_id); 53 pending_requests_.Remove(request_id);
50 } 54 }
51 55
52 } // namespace content 56 } // namespace content
OLDNEW
« no previous file with comments | « content/common/platform_notification_messages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698