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 #include "content/browser/broadcast_channel/broadcast_channel_provider.h" | 5 #include "content/browser/broadcast_channel/broadcast_channel_provider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "mojo/public/cpp/bindings/associated_binding.h" | 9 #include "mojo/public/cpp/bindings/associated_binding.h" |
10 #include "mojo/public/cpp/bindings/interface_ptr_set.h" | 10 #include "mojo/public/cpp/bindings/interface_ptr_set.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 | 60 |
61 void BroadcastChannelProvider::Connection::OnMessage( | 61 void BroadcastChannelProvider::Connection::OnMessage( |
62 const std::vector<uint8_t>& message) { | 62 const std::vector<uint8_t>& message) { |
63 service_->ReceivedMessageOnConnection(this, message); | 63 service_->ReceivedMessageOnConnection(this, message); |
64 } | 64 } |
65 | 65 |
66 BroadcastChannelProvider::BroadcastChannelProvider() {} | 66 BroadcastChannelProvider::BroadcastChannelProvider() {} |
67 | 67 |
68 void BroadcastChannelProvider::Connect( | 68 void BroadcastChannelProvider::Connect( |
69 mojo::InterfaceRequest<blink::mojom::BroadcastChannelProvider> request) { | 69 const service_manager::BindSourceInfo& source_info, |
| 70 blink::mojom::BroadcastChannelProviderRequest request) { |
70 bindings_.AddBinding(this, std::move(request)); | 71 bindings_.AddBinding(this, std::move(request)); |
71 } | 72 } |
72 | 73 |
73 void BroadcastChannelProvider::ConnectToChannel( | 74 void BroadcastChannelProvider::ConnectToChannel( |
74 const url::Origin& origin, | 75 const url::Origin& origin, |
75 const std::string& name, | 76 const std::string& name, |
76 blink::mojom::BroadcastChannelClientAssociatedPtrInfo client, | 77 blink::mojom::BroadcastChannelClientAssociatedPtrInfo client, |
77 blink::mojom::BroadcastChannelClientAssociatedRequest connection) { | 78 blink::mojom::BroadcastChannelClientAssociatedRequest connection) { |
78 std::unique_ptr<Connection> c(new Connection(origin, name, std::move(client), | 79 std::unique_ptr<Connection> c(new Connection(origin, name, std::move(client), |
79 std::move(connection), this)); | 80 std::move(connection), this)); |
(...skipping 26 matching lines...) Expand all Loading... |
106 auto& connections = connections_[c->origin()]; | 107 auto& connections = connections_[c->origin()]; |
107 for (auto it = connections.lower_bound(c->name()), | 108 for (auto it = connections.lower_bound(c->name()), |
108 end = connections.upper_bound(c->name()); | 109 end = connections.upper_bound(c->name()); |
109 it != end; ++it) { | 110 it != end; ++it) { |
110 if (it->second.get() != c) | 111 if (it->second.get() != c) |
111 it->second->MessageToClient(message); | 112 it->second->MessageToClient(message); |
112 } | 113 } |
113 } | 114 } |
114 | 115 |
115 } // namespace content | 116 } // namespace content |
OLD | NEW |