OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_BROADCAST_CHANNEL_BROADCAST_CHANNEL_PROVIDER_H_ | 5 #ifndef CONTENT_BROWSER_BROADCAST_CHANNEL_BROADCAST_CHANNEL_PROVIDER_H_ |
6 #define CONTENT_BROWSER_BROADCAST_CHANNEL_BROADCAST_CHANNEL_PROVIDER_H_ | 6 #define CONTENT_BROWSER_BROADCAST_CHANNEL_BROADCAST_CHANNEL_PROVIDER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "mojo/public/cpp/bindings/binding_set.h" | 11 #include "mojo/public/cpp/bindings/binding_set.h" |
12 #include "third_party/WebKit/public/platform/modules/broadcastchannel/broadcast_
channel.mojom.h" | 12 #include "third_party/WebKit/public/platform/modules/broadcastchannel/broadcast_
channel.mojom.h" |
13 #include "url/origin.h" | 13 #include "url/origin.h" |
14 | 14 |
| 15 namespace service_manager { |
| 16 struct BindSourceInfo; |
| 17 } |
| 18 |
15 namespace content { | 19 namespace content { |
16 | 20 |
17 class BroadcastChannelProvider | 21 class BroadcastChannelProvider |
18 : public base::RefCountedThreadSafe<BroadcastChannelProvider>, | 22 : public base::RefCountedThreadSafe<BroadcastChannelProvider>, |
19 public blink::mojom::BroadcastChannelProvider { | 23 public blink::mojom::BroadcastChannelProvider { |
20 public: | 24 public: |
21 BroadcastChannelProvider(); | 25 BroadcastChannelProvider(); |
22 void Connect( | 26 void Connect(const service_manager::BindSourceInfo& source_info, |
23 mojo::InterfaceRequest<blink::mojom::BroadcastChannelProvider> request); | 27 blink::mojom::BroadcastChannelProviderRequest request); |
24 | 28 |
25 void ConnectToChannel( | 29 void ConnectToChannel( |
26 const url::Origin& origin, | 30 const url::Origin& origin, |
27 const std::string& name, | 31 const std::string& name, |
28 blink::mojom::BroadcastChannelClientAssociatedPtrInfo client, | 32 blink::mojom::BroadcastChannelClientAssociatedPtrInfo client, |
29 blink::mojom::BroadcastChannelClientAssociatedRequest connection) | 33 blink::mojom::BroadcastChannelClientAssociatedRequest connection) |
30 override; | 34 override; |
31 | 35 |
32 private: | 36 private: |
33 friend class base::RefCountedThreadSafe<BroadcastChannelProvider>; | 37 friend class base::RefCountedThreadSafe<BroadcastChannelProvider>; |
34 class Connection; | 38 class Connection; |
35 | 39 |
36 ~BroadcastChannelProvider() override; | 40 ~BroadcastChannelProvider() override; |
37 | 41 |
38 void UnregisterConnection(Connection*); | 42 void UnregisterConnection(Connection*); |
39 void ReceivedMessageOnConnection(Connection*, | 43 void ReceivedMessageOnConnection(Connection*, |
40 const std::vector<uint8_t>& message); | 44 const std::vector<uint8_t>& message); |
41 | 45 |
42 mojo::BindingSet<blink::mojom::BroadcastChannelProvider> bindings_; | 46 mojo::BindingSet<blink::mojom::BroadcastChannelProvider> bindings_; |
43 std::map<url::Origin, std::multimap<std::string, std::unique_ptr<Connection>>> | 47 std::map<url::Origin, std::multimap<std::string, std::unique_ptr<Connection>>> |
44 connections_; | 48 connections_; |
45 }; | 49 }; |
46 | 50 |
47 } // namespace content | 51 } // namespace content |
48 | 52 |
49 #endif // CONTENT_BROWSER_BROADCAST_CHANNEL_BROADCAST_CHANNEL_PROVIDER_H_ | 53 #endif // CONTENT_BROWSER_BROADCAST_CHANNEL_BROADCAST_CHANNEL_PROVIDER_H_ |
OLD | NEW |