cc: Make picture pile base thread safe.
[chromium-blink-merge.git] / content / renderer / push_messaging_dispatcher.h
blob1d6c87dc7930378e7e69399f57b39da7254f43ab
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.
5 #ifndef CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_
6 #define CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_
8 #include <string>
10 #include "base/id_map.h"
11 #include "content/public/common/push_messaging_status.h"
12 #include "content/public/renderer/render_frame_observer.h"
13 #include "third_party/WebKit/public/platform/WebPushClient.h"
15 class GURL;
17 namespace IPC {
18 class Message;
19 } // namespace IPC
21 namespace blink {
22 class WebServiceWorkerProvider;
23 } // namespace blink
25 namespace content {
27 struct Manifest;
29 class PushMessagingDispatcher : public RenderFrameObserver,
30 public blink::WebPushClient {
31 public:
32 explicit PushMessagingDispatcher(RenderFrame* render_frame);
33 virtual ~PushMessagingDispatcher();
35 private:
36 // RenderFrame::Observer implementation.
37 bool OnMessageReceived(const IPC::Message& message) override;
39 // WebPushClient implementation.
40 virtual void registerPushMessaging(
41 blink::WebPushRegistrationCallbacks* callbacks,
42 blink::WebServiceWorkerProvider* service_worker_provider);
44 void DoRegister(blink::WebPushRegistrationCallbacks* callbacks,
45 blink::WebServiceWorkerProvider* service_worker_provider,
46 const Manifest& manifest);
48 void OnRegisterSuccess(int32 callbacks_id,
49 const GURL& endpoint,
50 const std::string& registration_id);
52 void OnRegisterError(int32 callbacks_id, PushRegistrationStatus status);
54 IDMap<blink::WebPushRegistrationCallbacks, IDMapOwnPointer>
55 registration_callbacks_;
57 DISALLOW_COPY_AND_ASSIGN(PushMessagingDispatcher);
60 } // namespace content
62 #endif // CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_