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

Unified Diff: content/public/browser/push_messaging_router.h

Issue 340773006: Dispatch push event to worker from PushServiceImpl#OnMessage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Get registration from storage if necessary. Created 6 years, 5 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/public/browser/push_messaging_router.h
diff --git a/content/public/browser/push_messaging_router.h b/content/public/browser/push_messaging_router.h
new file mode 100644
index 0000000000000000000000000000000000000000..4e7d9d092620a7b16a76d4229f98492b88bfaa04
--- /dev/null
+++ b/content/public/browser/push_messaging_router.h
@@ -0,0 +1,41 @@
+// 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_PUBLIC_BROWSER_PUSH_MESSAGING_ROUTER_H_
+#define CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_ROUTER_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/common/content_export.h"
+#include "content/public/common/push_messaging_status.h"
+
+namespace content {
+
+class BrowserContext;
+struct PushMessagingApplicationId;
+
+// Routes messages from a PushMessagingService to the correct Service Worker.
+class CONTENT_EXPORT PushMessagingRouter {
+ public:
+ static scoped_ptr<PushMessagingRouter> Create(
+ BrowserContext* browser_context);
+
+ typedef base::Callback<void(PushMessagingStatus /* push_messaging_status */)>
+ SendMessageCallback;
+
+ // Sends a push message with |data| to the Service Worker identified by
+ // |application_id|. Must be called on the UI thread.
+ virtual void SendMessage(
johnme 2014/07/23 14:25:23 s/Send/Deliver/ to avoid confusion with upstream m
Michael van Ouwerkerk 2014/07/23 16:57:52 Done.
+ const PushMessagingApplicationId& application_id,
+ const std::string& data,
+ const SendMessageCallback& send_message_callback) = 0;
+
+ virtual ~PushMessagingRouter() {}
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_ROUTER_H_

Powered by Google App Engine
This is Rietveld 408576698