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

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

Issue 944443003: Step two of optionally sending messages to/from message ports as base::Value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-c-message-as-values-take2
Patch Set: use auto where it makes sense Created 5 years, 9 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 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_CONTEXT_IMPL_H_ 5 #ifndef CONTENT_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_CONTEXT_IMPL_H_
6 #define CONTENT_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_CONTEXT_IMPL_H_ 6 #define CONTENT_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_CONTEXT_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include "base/callback_forward.h" 9 #include "base/callback_forward.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
11 #include "content/public/browser/message_port_delegate.h" 11 #include "content/public/browser/message_port_delegate.h"
12 #include "content/public/browser/navigator_connect_context.h" 12 #include "content/public/browser/navigator_connect_context.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 class MessagePortMessageFilter; 16 class MessagePortMessageFilter;
17 struct NavigatorConnectClient;
18 class NavigatorConnectService; 17 class NavigatorConnectService;
19 class NavigatorConnectServiceFactory; 18 class NavigatorConnectServiceFactory;
19 struct NavigatorConnectClient;
20 struct TransferredMessagePort;
20 21
21 // Tracks all active navigator.connect connections, as well as available service 22 // Tracks all active navigator.connect connections, as well as available service
22 // factories. Delegates connection requests to the correct factory and passes 23 // factories. Delegates connection requests to the correct factory and passes
23 // messages on to the correct service. 24 // messages on to the correct service.
24 // One instance of this class exists per StoragePartition. 25 // One instance of this class exists per StoragePartition.
25 // TODO(mek): Somehow clean up connections when the client side goes away. 26 // TODO(mek): Somehow clean up connections when the client side goes away.
26 class NavigatorConnectContextImpl : public NavigatorConnectContext { 27 class NavigatorConnectContextImpl : public NavigatorConnectContext {
27 public: 28 public:
28 using ConnectCallback = base::Callback< 29 using ConnectCallback =
29 void(int message_port_id, int message_port_route_id, bool success)>; 30 base::Callback<void(const TransferredMessagePort& message_port,
31 int message_port_route_id,
32 bool success)>;
30 33
31 explicit NavigatorConnectContextImpl(); 34 explicit NavigatorConnectContextImpl();
32 35
33 // Called when a new connection request comes in from a client. Finds the 36 // Called when a new connection request comes in from a client. Finds the
34 // correct service factory and passes the connection request off to there. 37 // correct service factory and passes the connection request off to there.
35 // Can call the callback before this method call returns. 38 // Can call the callback before this method call returns.
36 void Connect(NavigatorConnectClient client, 39 void Connect(NavigatorConnectClient client,
37 MessagePortMessageFilter* message_port_message_filter, 40 MessagePortMessageFilter* message_port_message_filter,
38 const ConnectCallback& callback); 41 const ConnectCallback& callback);
39 42
(...skipping 12 matching lines...) Expand all
52 const ConnectCallback& callback, 55 const ConnectCallback& callback,
53 MessagePortDelegate* delegate); 56 MessagePortDelegate* delegate);
54 57
55 // List of factories to try to handle URLs. 58 // List of factories to try to handle URLs.
56 ScopedVector<NavigatorConnectServiceFactory> service_factories_; 59 ScopedVector<NavigatorConnectServiceFactory> service_factories_;
57 }; 60 };
58 61
59 } // namespace content 62 } // namespace content
60 63
61 #endif // CONTENT_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_CONTEXT_IMPL_H_ 64 #endif // CONTENT_BROWSER_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_CONTEXT_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/message_port_service.cc ('k') | content/browser/navigator_connect/navigator_connect_context_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698