| OLD | NEW |
| 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/public/browser/browser_message_filter.h" | 8 #include "content/public/browser/browser_message_filter.h" |
| 9 | 9 |
| 10 class GURL; | 10 class GURL; |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 | 13 |
| 14 class MessagePortMessageFilter; | 14 class MessagePortMessageFilter; |
| 15 class NavigatorConnectContextImpl; |
| 15 struct NavigatorConnectClient; | 16 struct NavigatorConnectClient; |
| 16 class NavigatorConnectContextImpl; | 17 struct TransferredMessagePort; |
| 17 | 18 |
| 18 // Receives navigator.connect connection attempts from a child process. | 19 // Receives navigator.connect connection attempts from a child process. |
| 19 // Attempts to find a service that serves the URL the connection is made to | 20 // Attempts to find a service that serves the URL the connection is made to |
| 20 // and sets up the actual connection. | 21 // and sets up the actual connection. |
| 21 // Constructed on the UI thread, but all other methods are called on the IO | 22 // Constructed on the UI thread, but all other methods are called on the IO |
| 22 // thread. Typically there is one instance of this class for each renderer | 23 // thread. Typically there is one instance of this class for each renderer |
| 23 // process, and this class lives at least as long as the renderer process is | 24 // process, and this class lives at least as long as the renderer process is |
| 24 // alive (since this class is refcounted it could outlive the renderer process | 25 // alive (since this class is refcounted it could outlive the renderer process |
| 25 // if it is still handling a connection attempt). | 26 // if it is still handling a connection attempt). |
| 26 class NavigatorConnectDispatcherHost : public BrowserMessageFilter { | 27 class NavigatorConnectDispatcherHost : public BrowserMessageFilter { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 38 | 39 |
| 39 // IPC Message handlers. | 40 // IPC Message handlers. |
| 40 void OnConnect(int thread_id, | 41 void OnConnect(int thread_id, |
| 41 int request_id, | 42 int request_id, |
| 42 const NavigatorConnectClient& client); | 43 const NavigatorConnectClient& client); |
| 43 | 44 |
| 44 // Callback called when the service worker finished handling the cross origin | 45 // Callback called when the service worker finished handling the cross origin |
| 45 // connection event. | 46 // connection event. |
| 46 void OnConnectResult(int thread_id, | 47 void OnConnectResult(int thread_id, |
| 47 int request_id, | 48 int request_id, |
| 48 int message_port_id, | 49 const TransferredMessagePort& message_port, |
| 49 int message_port_route_id, | 50 int message_port_route_id, |
| 50 bool accept_connection); | 51 bool accept_connection); |
| 51 | 52 |
| 52 scoped_refptr<NavigatorConnectContextImpl> navigator_connect_context_; | 53 scoped_refptr<NavigatorConnectContextImpl> navigator_connect_context_; |
| 53 MessagePortMessageFilter* const message_port_message_filter_; | 54 MessagePortMessageFilter* const message_port_message_filter_; |
| 54 | 55 |
| 55 DISALLOW_COPY_AND_ASSIGN(NavigatorConnectDispatcherHost); | 56 DISALLOW_COPY_AND_ASSIGN(NavigatorConnectDispatcherHost); |
| 56 }; | 57 }; |
| 57 | 58 |
| 58 } // namespace content | 59 } // namespace content |
| 59 | 60 |
| 60 #endif // CONTENT_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_DISPATCHER_HOST_H
_ | 61 #endif // CONTENT_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_DISPATCHER_HOST_H
_ |
| OLD | NEW |