OLD | NEW |
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 #include <algorithm> | 5 #include <algorithm> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "mojo/converters/network/network_type_converters.h" | 10 #include "mojo/converters/network/network_type_converters.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 return nullptr; | 73 return nullptr; |
74 DCHECK(params); | 74 DCHECK(params); |
75 URLRequestPtr request = params->TakeRequest(); | 75 URLRequestPtr request = params->TakeRequest(); |
76 std::string application_url = request->url.To<std::string>(); | 76 std::string application_url = request->url.To<std::string>(); |
77 // We allow all interfaces on outgoing connections since we are presumably in | 77 // We allow all interfaces on outgoing connections since we are presumably in |
78 // a position to know who we're talking to. | 78 // a position to know who we're talking to. |
79 // TODO(beng): is this a valid assumption or do we need to figure some way to | 79 // TODO(beng): is this a valid assumption or do we need to figure some way to |
80 // filter here too? | 80 // filter here too? |
81 std::set<std::string> allowed; | 81 std::set<std::string> allowed; |
82 allowed.insert("*"); | 82 allowed.insert("*"); |
83 InterfaceProviderPtr local_interfaces; | 83 shell::mojom::InterfaceProviderPtr local_interfaces; |
84 InterfaceRequest<InterfaceProvider> local_request = | 84 shell::mojom::InterfaceProviderRequest local_request = |
85 GetProxy(&local_interfaces); | 85 GetProxy(&local_interfaces); |
86 InterfaceProviderPtr remote_interfaces; | 86 shell::mojom::InterfaceProviderPtr remote_interfaces; |
87 InterfaceRequest<InterfaceProvider> remote_request = | 87 shell::mojom::InterfaceProviderRequest remote_request = |
88 GetProxy(&remote_interfaces); | 88 GetProxy(&remote_interfaces); |
89 scoped_ptr<internal::ConnectionImpl> registry(new internal::ConnectionImpl( | 89 scoped_ptr<internal::ConnectionImpl> registry(new internal::ConnectionImpl( |
90 application_url, application_url, | 90 application_url, application_url, |
91 shell::mojom::Shell::kInvalidApplicationID, std::move(remote_interfaces), | 91 shell::mojom::Shell::kInvalidApplicationID, std::move(remote_interfaces), |
92 std::move(local_request), allowed)); | 92 std::move(local_request), allowed)); |
93 shell_->ConnectToApplication(std::move(request), | 93 shell_->ConnectToApplication(std::move(request), |
94 std::move(remote_request), | 94 std::move(remote_request), |
95 std::move(local_interfaces), | 95 std::move(local_interfaces), |
96 params->TakeFilter(), | 96 params->TakeFilter(), |
97 registry->GetConnectToApplicationCallback()); | 97 registry->GetConnectToApplicationCallback()); |
(...skipping 19 matching lines...) Expand all Loading... |
117 const mojo::String& url, | 117 const mojo::String& url, |
118 uint32_t id) { | 118 uint32_t id) { |
119 shell_ = std::move(shell); | 119 shell_ = std::move(shell); |
120 shell_.set_connection_error_handler([this]() { OnConnectionError(); }); | 120 shell_.set_connection_error_handler([this]() { OnConnectionError(); }); |
121 client_->Initialize(this, url, id); | 121 client_->Initialize(this, url, id); |
122 } | 122 } |
123 | 123 |
124 void ShellConnection::AcceptConnection( | 124 void ShellConnection::AcceptConnection( |
125 const String& requestor_url, | 125 const String& requestor_url, |
126 uint32_t requestor_id, | 126 uint32_t requestor_id, |
127 InterfaceRequest<InterfaceProvider> local_interfaces, | 127 shell::mojom::InterfaceProviderRequest local_interfaces, |
128 InterfaceProviderPtr remote_interfaces, | 128 shell::mojom::InterfaceProviderPtr remote_interfaces, |
129 Array<String> allowed_interfaces, | 129 Array<String> allowed_interfaces, |
130 const String& url) { | 130 const String& url) { |
131 scoped_ptr<Connection> registry(new internal::ConnectionImpl( | 131 scoped_ptr<Connection> registry(new internal::ConnectionImpl( |
132 url, requestor_url, requestor_id, std::move(remote_interfaces), | 132 url, requestor_url, requestor_id, std::move(remote_interfaces), |
133 std::move(local_interfaces), | 133 std::move(local_interfaces), |
134 allowed_interfaces.To<std::set<std::string>>())); | 134 allowed_interfaces.To<std::set<std::string>>())); |
135 if (!client_->AcceptConnection(registry.get())) | 135 if (!client_->AcceptConnection(registry.get())) |
136 return; | 136 return; |
137 | 137 |
138 // If we were quitting because we thought there were no more interfaces for | 138 // If we were quitting because we thought there were no more interfaces for |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 shell::mojom::CapabilityFilterPtr CreatePermissiveCapabilityFilter() { | 182 shell::mojom::CapabilityFilterPtr CreatePermissiveCapabilityFilter() { |
183 shell::mojom::CapabilityFilterPtr filter( | 183 shell::mojom::CapabilityFilterPtr filter( |
184 shell::mojom::CapabilityFilter::New()); | 184 shell::mojom::CapabilityFilter::New()); |
185 Array<String> all_interfaces; | 185 Array<String> all_interfaces; |
186 all_interfaces.push_back("*"); | 186 all_interfaces.push_back("*"); |
187 filter->filter.insert("*", std::move(all_interfaces)); | 187 filter->filter.insert("*", std::move(all_interfaces)); |
188 return filter; | 188 return filter; |
189 } | 189 } |
190 | 190 |
191 } // namespace mojo | 191 } // namespace mojo |
OLD | NEW |