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

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

Issue 758603002: Use Mojo Permission Service when requesting Notifications permission. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission_geolocation_follow_up
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
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 #ifndef CONTENT_RENDERER_NOTIFICATION_PERMISSION_DISPATCHER_H_ 5 #ifndef CONTENT_RENDERER_NOTIFICATION_PERMISSION_DISPATCHER_H_
6 #define CONTENT_RENDERER_NOTIFICATION_PERMISSION_DISPATCHER_H_ 6 #define CONTENT_RENDERER_NOTIFICATION_PERMISSION_DISPATCHER_H_
7 7
8 #include "base/id_map.h" 8 #include "base/id_map.h"
9 #include "content/common/permission_service.mojom.h"
9 #include "content/public/renderer/render_frame_observer.h" 10 #include "content/public/renderer/render_frame_observer.h"
10 #include "ipc/ipc_message.h"
11 #include "third_party/WebKit/public/platform/WebNotificationPermission.h"
12 11
13 namespace blink { 12 namespace blink {
14 class WebNotificationPermissionCallback; 13 class WebNotificationPermissionCallback;
15 class WebSecurityOrigin; 14 class WebSecurityOrigin;
16 } 15 }
17 16
18 namespace content { 17 namespace content {
19 18
20 // Dispatcher for Web Notification permission requests. 19 // Dispatcher for Web Notification permission requests.
21 class NotificationPermissionDispatcher : public RenderFrameObserver { 20 class NotificationPermissionDispatcher : public RenderFrameObserver {
nasko 2014/11/25 00:44:58 Does this still need to be RenderFrameObserver?
nasko 2014/11/25 00:48:03 Nevermind, I answered my own question. It is still
22 public: 21 public:
23 explicit NotificationPermissionDispatcher(RenderFrame* render_frame); 22 explicit NotificationPermissionDispatcher(RenderFrame* render_frame);
24 ~NotificationPermissionDispatcher() override; 23 ~NotificationPermissionDispatcher() override;
25 24
26 // Requests permission to display Web Notifications for |origin|. The callback 25 // Requests permission to display Web Notifications for |origin|. The callback
27 // will be invoked when the permission status is available. This class will 26 // will be invoked when the permission status is available. This class will
28 // take ownership of |callback|. 27 // take ownership of |callback|.
29 void RequestPermission( 28 void RequestPermission(
30 const blink::WebSecurityOrigin& origin, 29 const blink::WebSecurityOrigin& origin,
31 blink::WebNotificationPermissionCallback* callback); 30 blink::WebNotificationPermissionCallback* callback);
32 31
33 private: 32 private:
34 // RenderFrameObserver implementation.
35 bool OnMessageReceived(const IPC::Message& message) override;
36
37 void OnPermissionRequestComplete( 33 void OnPermissionRequestComplete(
38 int request_id, blink::WebNotificationPermission result); 34 int request_id, PermissionStatus status);
39 35
40 // Tracks the active notification permission requests. This class takes 36 // Tracks the active notification permission requests. This class takes
41 // ownership of the created WebNotificationPermissionCallback objects. 37 // ownership of the created WebNotificationPermissionCallback objects.
42 IDMap<blink::WebNotificationPermissionCallback, IDMapOwnPointer> 38 IDMap<blink::WebNotificationPermissionCallback, IDMapOwnPointer>
43 pending_requests_; 39 pending_requests_;
44 40
41 PermissionServicePtr permission_service_;
42
45 DISALLOW_COPY_AND_ASSIGN(NotificationPermissionDispatcher); 43 DISALLOW_COPY_AND_ASSIGN(NotificationPermissionDispatcher);
46 }; 44 };
47 45
48 } // namespace content 46 } // namespace content
49 47
50 #endif // CONTENT_RENDERER_NOTIFICATION_PERMISSION_DISPATCHER_H_ 48 #endif // CONTENT_RENDERER_NOTIFICATION_PERMISSION_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698