OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_RENDERER_NOTIFICATION_PERMISSION_DISPATCHER_H_ | |
6 #define CONTENT_RENDERER_NOTIFICATION_PERMISSION_DISPATCHER_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | |
11 #include "content/public/renderer/render_frame_observer.h" | |
12 #include "third_party/WebKit/public/platform/modules/permissions/permission.mojo
m.h" | |
13 | |
14 namespace blink { | |
15 class WebNotificationPermissionCallback; | |
16 class WebSecurityOrigin; | |
17 } | |
18 | |
19 namespace content { | |
20 | |
21 class RenderFrame; | |
22 | |
23 // Dispatcher for Web Notification permission requests. | |
24 class NotificationPermissionDispatcher : public RenderFrameObserver { | |
25 public: | |
26 explicit NotificationPermissionDispatcher(RenderFrame* render_frame); | |
27 ~NotificationPermissionDispatcher() override; | |
28 | |
29 // Requests permission to display Web Notifications for |origin|. The callback | |
30 // will be invoked when the permission status is available. This class will | |
31 // take ownership of |callback|. | |
32 void RequestPermission(const blink::WebSecurityOrigin& origin, | |
33 blink::WebNotificationPermissionCallback* callback); | |
34 | |
35 private: | |
36 // RenderFrameObserver implementation. | |
37 void OnDestruct() override; | |
38 | |
39 void OnPermissionRequestComplete( | |
40 std::unique_ptr<blink::WebNotificationPermissionCallback> callback, | |
41 blink::mojom::PermissionStatus status); | |
42 | |
43 blink::mojom::PermissionServicePtr permission_service_; | |
44 | |
45 DISALLOW_COPY_AND_ASSIGN(NotificationPermissionDispatcher); | |
46 }; | |
47 | |
48 } // namespace content | |
49 | |
50 #endif // CONTENT_RENDERER_NOTIFICATION_PERMISSION_DISPATCHER_H_ | |
OLD | NEW |