| 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/service_manager/service_manager_connection_impl.h" | 5 #include "content/common/service_manager/service_manager_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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 } | 211 } |
| 212 | 212 |
| 213 void OnBrowserConnectionLost() { | 213 void OnBrowserConnectionLost() { |
| 214 DCHECK(io_thread_checker_.CalledOnValidThread()); | 214 DCHECK(io_thread_checker_.CalledOnValidThread()); |
| 215 has_browser_connection_ = false; | 215 has_browser_connection_ = false; |
| 216 } | 216 } |
| 217 | 217 |
| 218 ///////////////////////////////////////////////////////////////////////////// | 218 ///////////////////////////////////////////////////////////////////////////// |
| 219 // service_manager::Service implementation | 219 // service_manager::Service implementation |
| 220 | 220 |
| 221 void OnStart(const service_manager::Identity& identity) override { | 221 void OnStart(const service_manager::ServiceInfo& info) override { |
| 222 DCHECK(io_thread_checker_.CalledOnValidThread()); | 222 DCHECK(io_thread_checker_.CalledOnValidThread()); |
| 223 DCHECK(!initialize_handler_.is_null()); | 223 DCHECK(!initialize_handler_.is_null()); |
| 224 id_ = identity; | 224 id_ = info.identity; |
| 225 | 225 |
| 226 InitializeCallback handler = base::ResetAndReturn(&initialize_handler_); | 226 InitializeCallback handler = base::ResetAndReturn(&initialize_handler_); |
| 227 callback_task_runner_->PostTask(FROM_HERE, base::Bind(handler, identity)); | 227 callback_task_runner_->PostTask(FROM_HERE, base::Bind(handler, id_)); |
| 228 } | 228 } |
| 229 | 229 |
| 230 bool OnConnect(const service_manager::Identity& remote_identity, | 230 bool OnConnect(const service_manager::ServiceInfo& remote_info, |
| 231 service_manager::InterfaceRegistry* registry) override { | 231 service_manager::InterfaceRegistry* registry) override { |
| 232 DCHECK(io_thread_checker_.CalledOnValidThread()); | 232 DCHECK(io_thread_checker_.CalledOnValidThread()); |
| 233 std::string remote_service = remote_identity.name(); | 233 std::string remote_service = remote_info.identity.name(); |
| 234 if (remote_service == "service:service_manager") { | 234 if (remote_service == "service:service_manager") { |
| 235 // Only expose the ServiceFactory interface to the Service Manager. | 235 // Only expose the ServiceFactory interface to the Service Manager. |
| 236 registry->AddInterface<service_manager::mojom::ServiceFactory>(this); | 236 registry->AddInterface<service_manager::mojom::ServiceFactory>(this); |
| 237 return true; | 237 return true; |
| 238 } | 238 } |
| 239 | 239 |
| 240 bool accept = false; | 240 bool accept = false; |
| 241 { | 241 { |
| 242 base::AutoLock lock(lock_); | 242 base::AutoLock lock(lock_); |
| 243 for (auto& entry : connection_filters_) { | 243 for (auto& entry : connection_filters_) { |
| 244 accept |= entry.second->OnConnect(remote_identity, registry, | 244 accept |= entry.second->OnConnect(remote_info.identity, registry, |
| 245 service_context_->connector()); | 245 service_context_->connector()); |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 | 248 |
| 249 if (remote_identity.name() == "service:content_browser" && | 249 if (remote_service == "service:content_browser" && |
| 250 !has_browser_connection_) { | 250 !has_browser_connection_) { |
| 251 has_browser_connection_ = true; | 251 has_browser_connection_ = true; |
| 252 registry->set_default_binder(default_browser_binder_); | 252 registry->set_default_binder(default_browser_binder_); |
| 253 registry->SetConnectionLostClosure( | 253 registry->SetConnectionLostClosure( |
| 254 base::Bind(&IOThreadContext::OnBrowserConnectionLost, this)); | 254 base::Bind(&IOThreadContext::OnBrowserConnectionLost, this)); |
| 255 return true; | 255 return true; |
| 256 } | 256 } |
| 257 | 257 |
| 258 // If no filters were interested, reject the connection. | 258 // If no filters were interested, reject the connection. |
| 259 return accept; | 259 return accept; |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 | 502 |
| 503 void ServiceManagerConnectionImpl::GetInterface( | 503 void ServiceManagerConnectionImpl::GetInterface( |
| 504 service_manager::mojom::InterfaceProvider* provider, | 504 service_manager::mojom::InterfaceProvider* provider, |
| 505 const std::string& interface_name, | 505 const std::string& interface_name, |
| 506 mojo::ScopedMessagePipeHandle request_handle) { | 506 mojo::ScopedMessagePipeHandle request_handle) { |
| 507 provider->GetInterface(interface_name, std::move(request_handle)); | 507 provider->GetInterface(interface_name, std::move(request_handle)); |
| 508 } | 508 } |
| 509 | 509 |
| 510 } // namespace content | 510 } // namespace content |
| 511 | 511 |
| OLD | NEW |