| Index: mojo/public/cpp/application/lib/application.cc
|
| diff --git a/mojo/public/cpp/application/lib/application.cc b/mojo/public/cpp/application/lib/application.cc
|
| index fb2a897a906f2f1335a95d2db6c3594c56d48f7f..78f5a8bbd0e5528e6a4bbf9449de54b4a2108037 100644
|
| --- a/mojo/public/cpp/application/lib/application.cc
|
| +++ b/mojo/public/cpp/application/lib/application.cc
|
| @@ -6,62 +6,29 @@
|
|
|
| namespace mojo {
|
|
|
| -Application::Application() {}
|
| +Application::Application() : service_registry_(this) {}
|
|
|
| Application::Application(ScopedMessagePipeHandle service_provider_handle)
|
| - : internal::ServiceConnectorBase::Owner(service_provider_handle.Pass()) {
|
| -}
|
| + : service_registry_(this, service_provider_handle.Pass()) {}
|
|
|
| Application::Application(MojoHandle service_provider_handle)
|
| - : internal::ServiceConnectorBase::Owner(
|
| + : service_registry_(
|
| + this,
|
| mojo::MakeScopedHandle(
|
| MessagePipeHandle(service_provider_handle)).Pass()) {}
|
|
|
| -Application::~Application() {
|
| - for (NameToServiceConnectorMap::iterator i =
|
| - name_to_service_connector_.begin();
|
| - i != name_to_service_connector_.end(); ++i) {
|
| - delete i->second;
|
| - }
|
| - name_to_service_connector_.clear();
|
| -}
|
| -
|
| -void Application::Initialize() {}
|
| -
|
| -void Application::AddServiceConnector(
|
| - internal::ServiceConnectorBase* service_connector) {
|
| - name_to_service_connector_[service_connector->name()] = service_connector;
|
| - set_service_connector_owner(service_connector, this);
|
| -}
|
| +Application::~Application() {}
|
|
|
| -void Application::RemoveServiceConnector(
|
| - internal::ServiceConnectorBase* service_connector) {
|
| - NameToServiceConnectorMap::iterator it =
|
| - name_to_service_connector_.find(service_connector->name());
|
| - assert(it != name_to_service_connector_.end());
|
| - delete it->second;
|
| - name_to_service_connector_.erase(it);
|
| - if (name_to_service_connector_.empty())
|
| - service_provider_.reset();
|
| +bool Application::AllowIncomingConnection(const mojo::String& service_name,
|
| + const mojo::String& requestor_url) {
|
| + return true;
|
| }
|
|
|
| void Application::BindServiceProvider(
|
| - ScopedMessagePipeHandle service_provider_handle) {
|
| - service_provider_.Bind(service_provider_handle.Pass());
|
| - service_provider_.set_client(this);
|
| + ScopedMessagePipeHandle service_provider_handle) {
|
| + service_registry_.BindRemoteServiceProvider(service_provider_handle.Pass());
|
| }
|
|
|
| -void Application::ConnectToService(const mojo::String& service_url,
|
| - const mojo::String& service_name,
|
| - ScopedMessagePipeHandle client_handle,
|
| - const mojo::String& requestor_url) {
|
| - internal::ServiceConnectorBase* service_connector =
|
| - name_to_service_connector_[service_name];
|
| - assert(service_connector);
|
| - // requestor_url is ignored because the service_connector stores the url
|
| - // of the requestor safely.
|
| - return service_connector->ConnectToService(
|
| - service_url, service_name, client_handle.Pass());
|
| -}
|
| +void Application::Initialize() {}
|
|
|
| } // namespace mojo
|
|
|