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

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

Issue 661463002: Implement PushManager#hasPermission (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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_PUSH_MESSAGING_DISPATCHER_H_ 5 #ifndef CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_
6 #define CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_ 6 #define CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/id_map.h" 10 #include "base/id_map.h"
11 #include "content/public/common/push_messaging_status.h" 11 #include "content/public/common/push_messaging_status.h"
12 #include "content/public/renderer/render_frame_observer.h" 12 #include "content/public/renderer/render_frame_observer.h"
13 #include "third_party/WebKit/public/platform/WebPushClient.h" 13 #include "third_party/WebKit/public/platform/WebPushClient.h"
14 #include "third_party/WebKit/public/platform/WebPushPermissionStatus.h"
14 15
15 class GURL; 16 class GURL;
16 17
17 namespace IPC { 18 namespace IPC {
18 class Message; 19 class Message;
19 } // namespace IPC 20 } // namespace IPC
20 21
21 namespace blink { 22 namespace blink {
22 class WebServiceWorkerProvider; 23 class WebServiceWorkerProvider;
23 } // namespace blink 24 } // namespace blink
24 25
25 namespace content { 26 namespace content {
26 27
27 struct Manifest; 28 struct Manifest;
28 29
29 class PushMessagingDispatcher : public RenderFrameObserver, 30 class PushMessagingDispatcher : public RenderFrameObserver,
30 public blink::WebPushClient { 31 public blink::WebPushClient {
31 public: 32 public:
32 explicit PushMessagingDispatcher(RenderFrame* render_frame); 33 explicit PushMessagingDispatcher(RenderFrame* render_frame);
33 virtual ~PushMessagingDispatcher(); 34 virtual ~PushMessagingDispatcher();
34 35
35 private: 36 private:
36 // RenderFrame::Observer implementation. 37 // RenderFrame::Observer implementation.
37 bool OnMessageReceived(const IPC::Message& message) override; 38 bool OnMessageReceived(const IPC::Message& message) override;
38 39
39 // WebPushClient implementation. 40 // WebPushClient implementation.
40 virtual void registerPushMessaging( 41 virtual void registerPushMessaging(
41 blink::WebPushRegistrationCallbacks* callbacks, 42 blink::WebPushRegistrationCallbacks* callbacks,
42 blink::WebServiceWorkerProvider* service_worker_provider); 43 blink::WebServiceWorkerProvider* service_worker_provider); // override
43 44 virtual void getPermissionStatus(
45 blink::WebPushPermissionCallback* callback,
46 blink::WebServiceWorkerProvider* service_worker_provider); // override
44 void DoRegister(blink::WebPushRegistrationCallbacks* callbacks, 47 void DoRegister(blink::WebPushRegistrationCallbacks* callbacks,
mlamouri (slow - plz ping) 2014/10/29 20:13:33 nit: leave an empty line between |getPermissionSta
Miguel Garcia 2014/10/30 12:27:15 Done.
45 blink::WebServiceWorkerProvider* service_worker_provider, 48 blink::WebServiceWorkerProvider* service_worker_provider,
46 const Manifest& manifest); 49 const Manifest& manifest);
47 50
48 void OnRegisterSuccess(int32 callbacks_id, 51 void OnRegisterSuccess(int32 callbacks_id,
49 const GURL& endpoint, 52 const GURL& endpoint,
50 const std::string& registration_id); 53 const std::string& registration_id);
51 54
52 void OnRegisterError(int32 callbacks_id, PushRegistrationStatus status); 55 void OnRegisterError(int32 callbacks_id, PushRegistrationStatus status);
53 56
57 void OnPermissionStatus(int32 callback_id,
58 blink::WebPushPermissionStatus status);
59 void OnPermissionStatusFailure(int32 callback_id);
60
54 IDMap<blink::WebPushRegistrationCallbacks, IDMapOwnPointer> 61 IDMap<blink::WebPushRegistrationCallbacks, IDMapOwnPointer>
55 registration_callbacks_; 62 registration_callbacks_;
63 IDMap<blink::WebPushPermissionCallback, IDMapOwnPointer>
64 permission_check_callbacks_;
56 65
57 DISALLOW_COPY_AND_ASSIGN(PushMessagingDispatcher); 66 DISALLOW_COPY_AND_ASSIGN(PushMessagingDispatcher);
58 }; 67 };
59 68
60 } // namespace content 69 } // namespace content
61 70
62 #endif // CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_ 71 #endif // CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698