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

Side by Side Diff: content/browser/navigator_connect/navigator_connect_dispatcher_host.h

Issue 785133006: Enable messaging over a navigator.connect initiated channel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@navigator-connect_serviceside
Patch Set: add empty line Created 6 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
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_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_DISPATCHER_HOST_H_ 5 #ifndef CONTENT_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_DISPATCHER_HOST_H_ 6 #define CONTENT_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_DISPATCHER_HOST_H_
7 7
8 #include "content/common/service_worker/service_worker_status_code.h" 8 #include "content/common/service_worker/service_worker_status_code.h"
9 #include "content/public/browser/browser_message_filter.h" 9 #include "content/public/browser/browser_message_filter.h"
10 10
11 class GURL; 11 class GURL;
12 12
13 namespace content { 13 namespace content {
14 14
15 struct CrossOriginServiceWorkerClient; 15 struct CrossOriginServiceWorkerClient;
16 class NavigatorConnectContext;
16 class ServiceWorkerContextWrapper; 17 class ServiceWorkerContextWrapper;
17 class ServiceWorkerRegistration; 18 class ServiceWorkerRegistration;
18 19
19 // Receives navigator.connect connection attempts from a child process. 20 // Receives navigator.connect connection attempts from a child process.
20 // Attempts to find a service that serves the URL the connection is made to 21 // Attempts to find a service that serves the URL the connection is made to
21 // and sets up the actual connection. 22 // and sets up the actual connection.
22 // Constructed on the UI thread, but all other methods are called on the IO 23 // Constructed on the UI thread, but all other methods are called on the IO
23 // thread. Typically there is one instance of this class for each renderer 24 // thread. Typically there is one instance of this class for each renderer
24 // process, and this class lives at least as long as the renderer process is 25 // process, and this class lives at least as long as the renderer process is
25 // alive (since this class is refcounted it could outlive the renderer process 26 // alive (since this class is refcounted it could outlive the renderer process
26 // if it is still handling a connection attempt). 27 // if it is still handling a connection attempt).
27 class NavigatorConnectDispatcherHost : public BrowserMessageFilter { 28 class NavigatorConnectDispatcherHost : public BrowserMessageFilter {
28 public: 29 public:
29 explicit NavigatorConnectDispatcherHost( 30 NavigatorConnectDispatcherHost(
30 const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context); 31 const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context,
32 const scoped_refptr<NavigatorConnectContext>& navigator_connect_context);
31 33
32 private: 34 private:
33 ~NavigatorConnectDispatcherHost() override; 35 ~NavigatorConnectDispatcherHost() override;
34 36
35 // BrowserMessageFilter implementation. 37 // BrowserMessageFilter implementation.
36 bool OnMessageReceived(const IPC::Message& message) override; 38 bool OnMessageReceived(const IPC::Message& message) override;
37 39
38 // IPC Message handlers. 40 // IPC Message handlers.
39 void OnConnect(int thread_id, 41 void OnConnect(int thread_id,
40 int request_id, 42 int request_id,
(...skipping 12 matching lines...) Expand all
53 // connection event. 55 // connection event.
54 void OnConnectResult( 56 void OnConnectResult(
55 int thread_id, 57 int thread_id,
56 int request_id, 58 int request_id,
57 const CrossOriginServiceWorkerClient& client, 59 const CrossOriginServiceWorkerClient& client,
58 const scoped_refptr<ServiceWorkerRegistration>& registration, 60 const scoped_refptr<ServiceWorkerRegistration>& registration,
59 ServiceWorkerStatusCode status, 61 ServiceWorkerStatusCode status,
60 bool accept_connection); 62 bool accept_connection);
61 63
62 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; 64 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
65 scoped_refptr<NavigatorConnectContext> navigator_connect_context_;
63 66
64 DISALLOW_COPY_AND_ASSIGN(NavigatorConnectDispatcherHost); 67 DISALLOW_COPY_AND_ASSIGN(NavigatorConnectDispatcherHost);
65 }; 68 };
66 69
67 } // namespace content 70 } // namespace content
68 71
69 #endif // CONTENT_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_DISPATCHER_HOST_H _ 72 #endif // CONTENT_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_DISPATCHER_HOST_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698