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 "mojo/public/cpp/application/lib/service_registry.h" | 5 #include "mojo/public/cpp/application/lib/service_registry.h" |
6 | 6 |
7 #include "mojo/public/cpp/application/application.h" | 7 #include "mojo/public/cpp/application/application.h" |
8 #include "mojo/public/cpp/application/lib/service_connector.h" | 8 #include "mojo/public/cpp/application/lib/service_connector.h" |
9 | 9 |
10 namespace mojo { | 10 namespace mojo { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 void ServiceRegistry::BindRemoteServiceProvider( | 51 void ServiceRegistry::BindRemoteServiceProvider( |
52 ScopedMessagePipeHandle service_provider_handle) { | 52 ScopedMessagePipeHandle service_provider_handle) { |
53 remote_service_provider_.Bind(service_provider_handle.Pass()); | 53 remote_service_provider_.Bind(service_provider_handle.Pass()); |
54 remote_service_provider_.set_client(this); | 54 remote_service_provider_.set_client(this); |
55 } | 55 } |
56 | 56 |
57 void ServiceRegistry::ConnectToService(const mojo::String& service_url, | 57 void ServiceRegistry::ConnectToService(const mojo::String& service_url, |
58 const mojo::String& service_name, | 58 const mojo::String& service_name, |
59 ScopedMessagePipeHandle client_handle, | 59 ScopedMessagePipeHandle client_handle, |
60 const mojo::String& requestor_url) { | 60 const mojo::String& requestor_url) { |
61 if (!application_->AllowIncomingConnection(service_name, requestor_url)) { | 61 if (!application_->AllowIncomingConnection(service_name, requestor_url) || |
62 name_to_service_connector_.find(service_name) == | |
viettrungluu
2014/06/18 14:52:06
I wonder if we shouldn't reverse the order of the
tim (not reviewing)
2014/06/18 20:18:20
I like that better than what I had. It seems more
| |
63 name_to_service_connector_.end()) { | |
62 client_handle.reset(); | 64 client_handle.reset(); |
63 return; | 65 return; |
64 } | 66 } |
65 | 67 |
66 internal::ServiceConnectorBase* service_connector = | 68 internal::ServiceConnectorBase* service_connector = |
67 name_to_service_connector_[service_name]; | 69 name_to_service_connector_[service_name]; |
68 assert(service_connector); | 70 assert(service_connector); |
69 // requestor_url is ignored because the service_connector stores the url | 71 // requestor_url is ignored because the service_connector stores the url |
70 // of the requestor safely. | 72 // of the requestor safely. |
71 return service_connector->ConnectToService( | 73 return service_connector->ConnectToService( |
72 service_url, service_name, client_handle.Pass()); | 74 service_url, service_name, client_handle.Pass()); |
73 } | 75 } |
74 | 76 |
75 } // namespace internal | 77 } // namespace internal |
76 } // namespace mojo | 78 } // namespace mojo |
OLD | NEW |