| 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/common/mojo/mojo_shell_connection_impl.h" | 5 #include "content/common/mojo/mojo_shell_connection_impl.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 id_ = identity; | 220 id_ = identity; |
| 221 | 221 |
| 222 InitializeCallback handler = base::ResetAndReturn(&initialize_handler_); | 222 InitializeCallback handler = base::ResetAndReturn(&initialize_handler_); |
| 223 callback_task_runner_->PostTask(FROM_HERE, base::Bind(handler, identity)); | 223 callback_task_runner_->PostTask(FROM_HERE, base::Bind(handler, identity)); |
| 224 } | 224 } |
| 225 | 225 |
| 226 bool OnConnect(const shell::Identity& remote_identity, | 226 bool OnConnect(const shell::Identity& remote_identity, |
| 227 shell::InterfaceRegistry* registry) override { | 227 shell::InterfaceRegistry* registry) override { |
| 228 DCHECK(io_thread_checker_.CalledOnValidThread()); | 228 DCHECK(io_thread_checker_.CalledOnValidThread()); |
| 229 std::string remote_app = remote_identity.name(); | 229 std::string remote_app = remote_identity.name(); |
| 230 if (remote_app == "mojo:shell") { | 230 if (remote_app == "service:shell") { |
| 231 // Only expose the SCF interface to the shell. | 231 // Only expose the SCF interface to the shell. |
| 232 registry->AddInterface<shell::mojom::ServiceFactory>(this); | 232 registry->AddInterface<shell::mojom::ServiceFactory>(this); |
| 233 return true; | 233 return true; |
| 234 } | 234 } |
| 235 | 235 |
| 236 bool accept = false; | 236 bool accept = false; |
| 237 { | 237 { |
| 238 base::AutoLock lock(lock_); | 238 base::AutoLock lock(lock_); |
| 239 for (auto& entry : connection_filters_) { | 239 for (auto& entry : connection_filters_) { |
| 240 accept |= entry.second->OnConnect(remote_identity, registry, | 240 accept |= entry.second->OnConnect(remote_identity, registry, |
| 241 service_context_->connector()); | 241 service_context_->connector()); |
| 242 } | 242 } |
| 243 } | 243 } |
| 244 | 244 |
| 245 if (remote_identity.name() == "exe:content_browser" && | 245 if (remote_identity.name() == "service:content_browser" && |
| 246 !has_browser_connection_) { | 246 !has_browser_connection_) { |
| 247 has_browser_connection_ = true; | 247 has_browser_connection_ = true; |
| 248 registry->set_default_binder(default_browser_binder_); | 248 registry->set_default_binder(default_browser_binder_); |
| 249 registry->SetConnectionLostClosure( | 249 registry->SetConnectionLostClosure( |
| 250 base::Bind(&IOThreadContext::OnBrowserConnectionLost, this)); | 250 base::Bind(&IOThreadContext::OnBrowserConnectionLost, this)); |
| 251 return true; | 251 return true; |
| 252 } | 252 } |
| 253 | 253 |
| 254 // If no filters were interested, reject the connection. | 254 // If no filters were interested, reject the connection. |
| 255 return accept; | 255 return accept; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 | 495 |
| 496 void MojoShellConnectionImpl::GetInterface( | 496 void MojoShellConnectionImpl::GetInterface( |
| 497 shell::mojom::InterfaceProvider* provider, | 497 shell::mojom::InterfaceProvider* provider, |
| 498 const std::string& interface_name, | 498 const std::string& interface_name, |
| 499 mojo::ScopedMessagePipeHandle request_handle) { | 499 mojo::ScopedMessagePipeHandle request_handle) { |
| 500 provider->GetInterface(interface_name, std::move(request_handle)); | 500 provider->GetInterface(interface_name, std::move(request_handle)); |
| 501 } | 501 } |
| 502 | 502 |
| 503 } // namespace content | 503 } // namespace content |
| 504 | 504 |
| OLD | NEW |