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

Unified Diff: content/renderer/push_messaging_dispatcher.h

Issue 219653002: Push API: send and receive IPC messages for registration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 months 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/push_messaging_dispatcher.h
diff --git a/content/renderer/push_messaging_dispatcher.h b/content/renderer/push_messaging_dispatcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..4c6abb8f8b6e0a46bdeba8fc69c95f31860fc707
--- /dev/null
+++ b/content/renderer/push_messaging_dispatcher.h
@@ -0,0 +1,49 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_
+#define CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_
+
+#include <string>
+
+#include "base/id_map.h"
+#include "content/public/common/push_messaging_status.h"
+#include "content/public/renderer/render_view_observer.h"
+#include "third_party/WebKit/public/platform/WebPushClient.h"
+#include "third_party/WebKit/public/platform/WebPushError.h"
+#include "third_party/WebKit/public/platform/WebString.h"
+
Peter Beverloo 2014/04/01 14:53:18 +#include "ipc/ipc_message.h"
Michael van Ouwerkerk 2014/04/02 14:25:15 Done.
+namespace content {
+class RenderViewImpl;
+
+class PushMessagingDispatcher : public RenderViewObserver,
+ public blink::WebPushClient {
+ public:
+ explicit PushMessagingDispatcher(RenderViewImpl* render_view);
+ virtual ~PushMessagingDispatcher();
+
+ private:
+ // RenderView::Observer implementation.
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+
+ // WebPushClient implementation.
+ virtual void registerPushMessaging(
+ const blink::WebString& sender_id,
+ blink::WebPushRegistrationCallbacks* callbacks) OVERRIDE;
+
+ void OnRegisterSuccess(int32 callbacks_id,
+ const std::string& endpoint,
+ const std::string& registration_id);
+
+ void OnRegisterError(int32 callbacks_id, PushMessagingStatus status);
+
+ IDMap<blink::WebPushRegistrationCallbacks, IDMapOwnPointer>
+ registration_callbacks_;
+
+ DISALLOW_COPY_AND_ASSIGN(PushMessagingDispatcher);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_PUSH_MESSAGING_DISPATCHER_H_

Powered by Google App Engine
This is Rietveld 408576698