| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_DISPATCHER_HOST_H_ | |
| 6 #define CONTENT_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_DISPATCHER_HOST_H_ | |
| 7 | |
| 8 #include "content/public/browser/browser_message_filter.h" | |
| 9 | |
| 10 class GURL; | |
| 11 | |
| 12 namespace content { | |
| 13 | |
| 14 class MessagePortMessageFilter; | |
| 15 class NavigatorConnectContextImpl; | |
| 16 struct NavigatorConnectClient; | |
| 17 struct TransferredMessagePort; | |
| 18 | |
| 19 // 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 // and sets up the actual connection. | |
| 22 // 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 // 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 // if it is still handling a connection attempt). | |
| 27 class NavigatorConnectDispatcherHost : public BrowserMessageFilter { | |
| 28 public: | |
| 29 NavigatorConnectDispatcherHost( | |
| 30 const scoped_refptr<NavigatorConnectContextImpl>& | |
| 31 navigator_connect_context, | |
| 32 MessagePortMessageFilter* message_port_message_filter); | |
| 33 | |
| 34 private: | |
| 35 ~NavigatorConnectDispatcherHost() override; | |
| 36 | |
| 37 // BrowserMessageFilter implementation. | |
| 38 bool OnMessageReceived(const IPC::Message& message) override; | |
| 39 | |
| 40 // IPC Message handlers. | |
| 41 void OnConnect(int thread_id, | |
| 42 int request_id, | |
| 43 const NavigatorConnectClient& client); | |
| 44 | |
| 45 // Callback called when the service worker finished handling the cross origin | |
| 46 // connection event. | |
| 47 void OnConnectResult(int thread_id, | |
| 48 int request_id, | |
| 49 const TransferredMessagePort& message_port, | |
| 50 int message_port_route_id, | |
| 51 bool accept_connection); | |
| 52 | |
| 53 scoped_refptr<NavigatorConnectContextImpl> navigator_connect_context_; | |
| 54 MessagePortMessageFilter* const message_port_message_filter_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(NavigatorConnectDispatcherHost); | |
| 57 }; | |
| 58 | |
| 59 } // namespace content | |
| 60 | |
| 61 #endif // CONTENT_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_DISPATCHER_HOST_H
_ | |
| OLD | NEW |