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

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

Issue 1471833002: Stop using base::IDMap in the NotificationPermissionDispatcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « no previous file | content/renderer/notification_permission_dispatcher.cc » ('j') | 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 #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/memory/scoped_ptr.h"
9 #include "content/common/permission_service.mojom.h" 9 #include "content/common/permission_service.mojom.h"
10 #include "content/public/renderer/render_frame_observer.h" 10 #include "content/public/renderer/render_frame_observer.h"
11 11
12 namespace blink { 12 namespace blink {
13 class WebNotificationPermissionCallback; 13 class WebNotificationPermissionCallback;
14 class WebSecurityOrigin; 14 class WebSecurityOrigin;
15 } 15 }
16 16
17 namespace content { 17 namespace content {
18 18
19 class RenderFrame;
20
19 // Dispatcher for Web Notification permission requests. 21 // Dispatcher for Web Notification permission requests.
20 class NotificationPermissionDispatcher : public RenderFrameObserver { 22 class NotificationPermissionDispatcher : public RenderFrameObserver {
21 public: 23 public:
22 explicit NotificationPermissionDispatcher(RenderFrame* render_frame); 24 explicit NotificationPermissionDispatcher(RenderFrame* render_frame);
23 ~NotificationPermissionDispatcher() override; 25 ~NotificationPermissionDispatcher() override;
24 26
25 // Requests permission to display Web Notifications for |origin|. The callback 27 // Requests permission to display Web Notifications for |origin|. The callback
26 // will be invoked when the permission status is available. This class will 28 // will be invoked when the permission status is available. This class will
27 // take ownership of |callback|. 29 // take ownership of |callback|.
28 void RequestPermission( 30 void RequestPermission(const blink::WebSecurityOrigin& origin,
29 const blink::WebSecurityOrigin& origin, 31 blink::WebNotificationPermissionCallback* callback);
30 blink::WebNotificationPermissionCallback* callback);
31 32
32 private: 33 private:
33 void OnPermissionRequestComplete( 34 void OnPermissionRequestComplete(
34 int request_id, PermissionStatus status); 35 scoped_ptr<blink::WebNotificationPermissionCallback> callback,
35 36 PermissionStatus status);
36 // Tracks the active notification permission requests. This class takes
37 // ownership of the created WebNotificationPermissionCallback objects.
38 IDMap<blink::WebNotificationPermissionCallback, IDMapOwnPointer>
39 pending_requests_;
40 37
41 PermissionServicePtr permission_service_; 38 PermissionServicePtr permission_service_;
42 39
43 DISALLOW_COPY_AND_ASSIGN(NotificationPermissionDispatcher); 40 DISALLOW_COPY_AND_ASSIGN(NotificationPermissionDispatcher);
44 }; 41 };
45 42
46 } // namespace content 43 } // namespace content
47 44
48 #endif // CONTENT_RENDERER_NOTIFICATION_PERMISSION_DISPATCHER_H_ 45 #endif // CONTENT_RENDERER_NOTIFICATION_PERMISSION_DISPATCHER_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/notification_permission_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698