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/application/public/cpp/lib/service_registry.h" | 5 #include "mojo/application/public/cpp/lib/service_registry.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 #include "mojo/application/public/cpp/application_connection.h" | 11 #include "mojo/application/public/cpp/application_connection.h" |
10 #include "mojo/application/public/cpp/service_connector.h" | 12 #include "mojo/application/public/cpp/service_connector.h" |
11 | 13 |
12 namespace mojo { | 14 namespace mojo { |
13 namespace internal { | 15 namespace internal { |
14 | 16 |
15 ServiceRegistry::ServiceRegistry( | 17 ServiceRegistry::ServiceRegistry( |
16 const std::string& connection_url, | 18 const std::string& connection_url, |
17 const std::string& remote_url, | 19 const std::string& remote_url, |
18 ServiceProviderPtr remote_services, | 20 ServiceProviderPtr remote_services, |
19 InterfaceRequest<ServiceProvider> local_services, | 21 InterfaceRequest<ServiceProvider> local_services, |
20 const std::set<std::string>& allowed_interfaces) | 22 const std::set<std::string>& allowed_interfaces) |
21 : connection_url_(connection_url), | 23 : connection_url_(connection_url), |
22 remote_url_(remote_url), | 24 remote_url_(remote_url), |
23 local_binding_(this), | 25 local_binding_(this), |
24 remote_service_provider_(remote_services.Pass()), | 26 remote_service_provider_(std::move(remote_services)), |
25 allowed_interfaces_(allowed_interfaces), | 27 allowed_interfaces_(allowed_interfaces), |
26 allow_all_interfaces_(allowed_interfaces_.size() == 1 && | 28 allow_all_interfaces_(allowed_interfaces_.size() == 1 && |
27 allowed_interfaces_.count("*") == 1), | 29 allowed_interfaces_.count("*") == 1), |
28 content_handler_id_(0u), | 30 content_handler_id_(0u), |
29 is_content_handler_id_valid_(false), | 31 is_content_handler_id_valid_(false), |
30 weak_factory_(this) { | 32 weak_factory_(this) { |
31 if (local_services.is_pending()) | 33 if (local_services.is_pending()) |
32 local_binding_.Bind(local_services.Pass()); | 34 local_binding_.Bind(std::move(local_services)); |
33 } | 35 } |
34 | 36 |
35 ServiceRegistry::ServiceRegistry() | 37 ServiceRegistry::ServiceRegistry() |
36 : local_binding_(this), | 38 : local_binding_(this), |
37 allow_all_interfaces_(true), | 39 allow_all_interfaces_(true), |
38 weak_factory_(this) { | 40 weak_factory_(this) { |
39 } | 41 } |
40 | 42 |
41 ServiceRegistry::~ServiceRegistry() { | 43 ServiceRegistry::~ServiceRegistry() { |
42 } | 44 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 content_handler_id_ = content_handler_id; | 122 content_handler_id_ = content_handler_id; |
121 std::vector<Closure> callbacks; | 123 std::vector<Closure> callbacks; |
122 callbacks.swap(content_handler_id_callbacks_); | 124 callbacks.swap(content_handler_id_callbacks_); |
123 for (auto callback : callbacks) | 125 for (auto callback : callbacks) |
124 callback.Run(); | 126 callback.Run(); |
125 } | 127 } |
126 | 128 |
127 void ServiceRegistry::ConnectToService(const mojo::String& service_name, | 129 void ServiceRegistry::ConnectToService(const mojo::String& service_name, |
128 ScopedMessagePipeHandle client_handle) { | 130 ScopedMessagePipeHandle client_handle) { |
129 service_connector_registry_.ConnectToService(this, service_name, | 131 service_connector_registry_.ConnectToService(this, service_name, |
130 client_handle.Pass()); | 132 std::move(client_handle)); |
131 } | 133 } |
132 | 134 |
133 } // namespace internal | 135 } // namespace internal |
134 } // namespace mojo | 136 } // namespace mojo |
OLD | NEW |