Supervised user import: Listen for profile creation/deletion
[chromium-blink-merge.git] / content / browser / navigator_connect / navigator_connect_dispatcher_host.h
blob614382eac2f5edd0926c81b59555360400450a25
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.
5 #ifndef CONTENT_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_DISPATCHER_HOST_H_
8 #include "content/public/browser/browser_message_filter.h"
10 class GURL;
12 namespace content {
14 class MessagePortMessageFilter;
15 class NavigatorConnectContextImpl;
16 struct NavigatorConnectClient;
17 struct TransferredMessagePort;
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);
34 private:
35 ~NavigatorConnectDispatcherHost() override;
37 // BrowserMessageFilter implementation.
38 bool OnMessageReceived(const IPC::Message& message) override;
40 // IPC Message handlers.
41 void OnConnect(int thread_id,
42 int request_id,
43 const NavigatorConnectClient& client);
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);
53 scoped_refptr<NavigatorConnectContextImpl> navigator_connect_context_;
54 MessagePortMessageFilter* const message_port_message_filter_;
56 DISALLOW_COPY_AND_ASSIGN(NavigatorConnectDispatcherHost);
59 } // namespace content
61 #endif // CONTENT_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_DISPATCHER_HOST_H_