Change InterfaceFactory<I>::Create() to take a ConnectionContext instead of an ApplicationConnection. This is part of a long road to nuke ApplicationConnection and InterfaceFactory (!) from orbit. R=vardhan@google.com Review URL: https://codereview.chromium.org/1975993002 .
diff --git a/apps/moterm/moterm_view.cc b/apps/moterm/moterm_view.cc index bf6fc46..413d486 100644 --- a/apps/moterm/moterm_view.cc +++ b/apps/moterm/moterm_view.cc
@@ -53,7 +53,11 @@ // TODO(vtl): |service_provider_impl_|'s ctor doesn't like an invalid request, // so we have to conditionally, explicitly bind. if (service_provider_request.is_pending()) { - service_provider_impl_.Bind(service_provider_request.Pass()); + // TODO(vtl): The connection context should probably be plumbed here, which + // means that mojo::ui::ViewProviderApp::CreateView() should probably have a + // connection context argument. + service_provider_impl_.Bind(mojo::ConnectionContext(), + service_provider_request.Pass()); service_provider_impl_.AddService<mojo::terminal::Terminal>(this); } @@ -130,7 +134,7 @@ } void MotermView::Create( - mojo::ApplicationConnection* connection, + const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<mojo::terminal::Terminal> request) { terminal_bindings_.AddBinding(this, request.Pass()); }
diff --git a/apps/moterm/moterm_view.h b/apps/moterm/moterm_view.h index 7f8b6a8..692670b 100644 --- a/apps/moterm/moterm_view.h +++ b/apps/moterm/moterm_view.h
@@ -62,7 +62,7 @@ // |mojo::InterfaceFactory<mojo::terminal::Terminal>|: void Create( - mojo::ApplicationConnection* connection, + const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<mojo::terminal::Terminal> request) override; // |mojo::terminal::Terminal| implementation:
diff --git a/examples/apptest/example_service_application.cc b/examples/apptest/example_service_application.cc index 9efceba..0487194 100644 --- a/examples/apptest/example_service_application.cc +++ b/examples/apptest/example_service_application.cc
@@ -23,7 +23,7 @@ } void ExampleServiceApplication::Create( - ApplicationConnection* connection, + const ConnectionContext& connection_context, InterfaceRequest<ExampleService> request) { // Not leaked: ExampleServiceImpl is strongly bound to the pipe. new ExampleServiceImpl(request.Pass());
diff --git a/examples/apptest/example_service_application.h b/examples/apptest/example_service_application.h index b995edc..e0a8cee 100644 --- a/examples/apptest/example_service_application.h +++ b/examples/apptest/example_service_application.h
@@ -26,7 +26,7 @@ ApplicationConnection* connection) override; // InterfaceFactory<ExampleService> implementation. - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<ExampleService> request) override; MOJO_DISALLOW_COPY_AND_ASSIGN(ExampleServiceApplication);
diff --git a/examples/bank_app/bank.cc b/examples/bank_app/bank.cc index b2ffbb3..7229c6f 100644 --- a/examples/bank_app/bank.cc +++ b/examples/bank_app/bank.cc
@@ -82,7 +82,7 @@ return true; } - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<Bank> request) override { bindings_.AddBinding(&bank_impl_, request.Pass()); }
diff --git a/examples/content_handler_demo/content_handler_demo.cc b/examples/content_handler_demo/content_handler_demo.cc index 21b564a..24fbd52 100644 --- a/examples/content_handler_demo/content_handler_demo.cc +++ b/examples/content_handler_demo/content_handler_demo.cc
@@ -105,7 +105,7 @@ return true; } - void Create(ApplicationConnection* app, + void Create(const ConnectionContext& connection_context, InterfaceRequest<ContentHandler> request) override { new ContentHandlerImpl(request.Pass()); }
diff --git a/examples/echo/echo_server.cc b/examples/echo/echo_server.cc index 43a975e..7cd54d5 100644 --- a/examples/echo/echo_server.cc +++ b/examples/echo/echo_server.cc
@@ -64,7 +64,7 @@ } // From InterfaceFactory<Echo> - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<Echo> request) override { // This object will be deleted automatically because of the use of // StrongBinding<> for the declaration of |strong_binding_|. @@ -87,7 +87,7 @@ } // From InterfaceFactory<Echo> - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<Echo> request) override { // All channels will connect to this singleton object, so just // add the binding to our collection. @@ -119,7 +119,7 @@ } // From InterfaceFactory<Echo> - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<Echo> request) override { binding_.Bind(request.Pass()); }
diff --git a/examples/echo_terminal/main.cc b/examples/echo_terminal/main.cc index f4a0ec1..348d96c 100644 --- a/examples/echo_terminal/main.cc +++ b/examples/echo_terminal/main.cc
@@ -114,7 +114,7 @@ // |InterfaceFactory<mojo::terminal::TerminalClient>| implementation: void Create( - mojo::ApplicationConnection* connection, + const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<mojo::terminal::TerminalClient> request) override { terminal_clients_.AddBinding(this, request.Pass()); }
diff --git a/examples/hello_mojo/hello_mojo_server.cc b/examples/hello_mojo/hello_mojo_server.cc index 08efddd..6d0060a 100644 --- a/examples/hello_mojo/hello_mojo_server.cc +++ b/examples/hello_mojo/hello_mojo_server.cc
@@ -52,7 +52,7 @@ } // |mojo::InterfaceFactory<HelloMojo>| implementation: - void Create(mojo::ApplicationConnection* application_connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<HelloMojo> hello_mojo_request) override { new HelloMojoImpl(std::move(hello_mojo_request)); // Owns itself. }
diff --git a/examples/indirect_service/indirect_integer_service.cc b/examples/indirect_service/indirect_integer_service.cc index e1665a9..137eb10 100644 --- a/examples/indirect_service/indirect_integer_service.cc +++ b/examples/indirect_service/indirect_integer_service.cc
@@ -61,7 +61,7 @@ private: // InterfaceFactory<IndirectIntegerService> - void Create(ApplicationConnection* app, + void Create(const mojo::ConnectionContext& connection_context, InterfaceRequest<IndirectIntegerService> request) override { new IndirectIntegerServiceImpl(request.Pass()); }
diff --git a/examples/indirect_service/integer_service.cc b/examples/indirect_service/integer_service.cc index 42f718f..4927267 100644 --- a/examples/indirect_service/integer_service.cc +++ b/examples/indirect_service/integer_service.cc
@@ -40,7 +40,7 @@ private: // InterfaceFactory<IntegerService> - void Create(ApplicationConnection* app, + void Create(const mojo::ConnectionContext& connection_context, InterfaceRequest<IntegerService> request) override { new IntegerServiceImpl(request.Pass()); }
diff --git a/examples/native_run_app/native_run_app.cc b/examples/native_run_app/native_run_app.cc index 30645be..7a61636 100644 --- a/examples/native_run_app/native_run_app.cc +++ b/examples/native_run_app/native_run_app.cc
@@ -243,7 +243,7 @@ } // |InterfaceFactory<TerminalClient>| implementation: - void Create(mojo::ApplicationConnection* /*connection*/, + void Create(const mojo::ConnectionContext& /*connection_context*/, mojo::InterfaceRequest<TerminalClient> request) override { new TerminalClientImpl(request.Pass(), native_support_process_.get()); }
diff --git a/mojo/application/content_handler_factory.cc b/mojo/application/content_handler_factory.cc index a8c3b92..34c0ee4 100644 --- a/mojo/application/content_handler_factory.cc +++ b/mojo/application/content_handler_factory.cc
@@ -129,7 +129,7 @@ loop.Run(); } -void ContentHandlerFactory::Create(ApplicationConnection* connection, +void ContentHandlerFactory::Create(const ConnectionContext& connection_context, InterfaceRequest<ContentHandler> request) { new ContentHandlerImpl(delegate_, request.Pass()); }
diff --git a/mojo/application/content_handler_factory.h b/mojo/application/content_handler_factory.h index be47207..0d1d3e9 100644 --- a/mojo/application/content_handler_factory.h +++ b/mojo/application/content_handler_factory.h
@@ -51,7 +51,7 @@ private: // From InterfaceFactory: - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<ContentHandler> request) override; Delegate* delegate_;
diff --git a/mojo/public/cpp/application/interface_factory.h b/mojo/public/cpp/application/interface_factory.h index da07008..f459f6f 100644 --- a/mojo/public/cpp/application/interface_factory.h +++ b/mojo/public/cpp/application/interface_factory.h
@@ -9,9 +9,7 @@ namespace mojo { -class ApplicationConnection; -template <typename Interface> -class InterfaceRequest; +struct ConnectionContext; // Implement this class to provide implementations of a given interface and // bind them to incoming requests. The implementation of this class is @@ -21,7 +19,7 @@ class InterfaceFactory { public: virtual ~InterfaceFactory() {} - virtual void Create(ApplicationConnection* connection, + virtual void Create(const ConnectionContext& connection_context, InterfaceRequest<Interface> request) = 0; };
diff --git a/mojo/public/cpp/application/lib/interface_factory_connector.h b/mojo/public/cpp/application/lib/interface_factory_connector.h index 30bc8c5..0879636 100644 --- a/mojo/public/cpp/application/lib/interface_factory_connector.h +++ b/mojo/public/cpp/application/lib/interface_factory_connector.h
@@ -19,10 +19,10 @@ : factory_(factory) {} ~InterfaceFactoryConnector() override {} - void ConnectToService(ApplicationConnection* application_connection, + void ConnectToService(const ConnectionContext& connection_context, const std::string& interface_name, ScopedMessagePipeHandle client_handle) override { - factory_->Create(application_connection, + factory_->Create(connection_context, InterfaceRequest<Interface>(client_handle.Pass())); }
diff --git a/mojo/public/cpp/application/lib/service_connector_registry.cc b/mojo/public/cpp/application/lib/service_connector_registry.cc index a921d34..6a974de 100644 --- a/mojo/public/cpp/application/lib/service_connector_registry.cc +++ b/mojo/public/cpp/application/lib/service_connector_registry.cc
@@ -6,6 +6,8 @@ #include <utility> +#include "mojo/public/cpp/application/application_connection.h" +#include "mojo/public/cpp/application/connection_context.h" #include "mojo/public/cpp/application/service_connector.h" namespace mojo { @@ -31,12 +33,12 @@ } bool ServiceConnectorRegistry::ConnectToService( - ApplicationConnection* application_connection, + const ConnectionContext& connection_context, const std::string& interface_name, ScopedMessagePipeHandle* client_handle) { auto iter = name_to_service_connector_.find(interface_name); if (iter != name_to_service_connector_.end()) { - iter->second->ConnectToService(application_connection, interface_name, + iter->second->ConnectToService(connection_context, interface_name, client_handle->Pass()); return true; }
diff --git a/mojo/public/cpp/application/lib/service_connector_registry.h b/mojo/public/cpp/application/lib/service_connector_registry.h index b66d379..235d34d 100644 --- a/mojo/public/cpp/application/lib/service_connector_registry.h +++ b/mojo/public/cpp/application/lib/service_connector_registry.h
@@ -13,7 +13,7 @@ namespace mojo { -class ApplicationConnection; +struct ConnectionContext; class ServiceConnector; namespace internal { @@ -40,7 +40,7 @@ // |interface_name|. In that case, the |client_handle| is passed along // to the |ServiceConnector|. Otherwise, this function returns false and // |client_handle| is untouched. - bool ConnectToService(ApplicationConnection* application_connection, + bool ConnectToService(const ConnectionContext& connection_context, const std::string& interface_name, ScopedMessagePipeHandle* client_handle);
diff --git a/mojo/public/cpp/application/lib/service_provider_impl.cc b/mojo/public/cpp/application/lib/service_provider_impl.cc index e7978b6..70821e5 100644 --- a/mojo/public/cpp/application/lib/service_provider_impl.cc +++ b/mojo/public/cpp/application/lib/service_provider_impl.cc
@@ -14,29 +14,33 @@ } ServiceProviderImpl::ServiceProviderImpl( + const ConnectionContext& connection_context, InterfaceRequest<ServiceProvider> service_provider_request) - : binding_(this, service_provider_request.Pass()), + : connection_context_(connection_context), + binding_(this, service_provider_request.Pass()), fallback_service_provider_(nullptr) {} ServiceProviderImpl::~ServiceProviderImpl() {} void ServiceProviderImpl::Bind( + const ConnectionContext& connection_context, InterfaceRequest<ServiceProvider> service_provider_request) { + connection_context_ = connection_context; binding_.Bind(service_provider_request.Pass()); } void ServiceProviderImpl::Close() { - if (binding_.is_bound()) + if (binding_.is_bound()) { binding_.Close(); + connection_context_ = ConnectionContext(); + } } void ServiceProviderImpl::ConnectToService( const String& service_name, ScopedMessagePipeHandle client_handle) { - // TODO(beng): perhaps take app connection thru ctor so that we can pass - // ApplicationConnection through? bool service_found = service_connector_registry_.ConnectToService( - nullptr, service_name, &client_handle); + connection_context_, service_name, &client_handle); if (!service_found && fallback_service_provider_) { fallback_service_provider_->ConnectToService(service_name, client_handle.Pass());
diff --git a/mojo/public/cpp/application/lib/service_registry.cc b/mojo/public/cpp/application/lib/service_registry.cc index 3c34628..d48f161 100644 --- a/mojo/public/cpp/application/lib/service_registry.cc +++ b/mojo/public/cpp/application/lib/service_registry.cc
@@ -48,8 +48,8 @@ void ServiceRegistry::ConnectToService(const String& service_name, ScopedMessagePipeHandle client_handle) { - service_connector_registry_.ConnectToService(this, service_name, - &client_handle); + service_connector_registry_.ConnectToService(connection_context_, + service_name, &client_handle); } } // namespace internal
diff --git a/mojo/public/cpp/application/service_connector.h b/mojo/public/cpp/application/service_connector.h index 6dd6c86..378be9e 100644 --- a/mojo/public/cpp/application/service_connector.h +++ b/mojo/public/cpp/application/service_connector.h
@@ -11,7 +11,7 @@ namespace mojo { -class ApplicationConnection; +struct ConnectionContext; class ServiceConnector { public: @@ -20,7 +20,7 @@ // Asks the ServiceConnector to connect to the specified service. If the // ServiceConnector connects to the service it should take ownership of // the handle in |handle|. - virtual void ConnectToService(ApplicationConnection* application_connection, + virtual void ConnectToService(const ConnectionContext& connection_context, const std::string& interface_name, ScopedMessagePipeHandle handle) = 0; };
diff --git a/mojo/public/cpp/application/service_provider_impl.h b/mojo/public/cpp/application/service_provider_impl.h index b885924..dd24472 100644 --- a/mojo/public/cpp/application/service_provider_impl.h +++ b/mojo/public/cpp/application/service_provider_impl.h
@@ -37,18 +37,16 @@ // Constructs this service provider implementation, binding it to the given // interface request. - // TODO(vtl): This should take a |ConnectionContext|, to provide - // |InterfaceRequestHandler<I>|s. explicit ServiceProviderImpl( + const ConnectionContext& connection_context, InterfaceRequest<ServiceProvider> service_provider_request); ~ServiceProviderImpl() override; // Binds this service provider implementation to the given interface request. // This may only be called if this object is unbound. - // TODO(vtl): This should take a |ConnectionContext|, to provide - // |InterfaceRequestHandler<I>|s. - void Bind(InterfaceRequest<ServiceProvider> service_provider_request); + void Bind(const ConnectionContext& connection_context, + InterfaceRequest<ServiceProvider> service_provider_request); // Disconnect this service provider implementation and put it in a state where // it can be rebound to a new request (i.e., restores this object to an @@ -110,15 +108,11 @@ : interface_request_handler_(std::move(interface_request_handler)) {} ~ServiceConnectorImpl() override {} - void ConnectToService(ApplicationConnection* application_connection, + void ConnectToService(const mojo::ConnectionContext& connection_context, const std::string& interface_name, ScopedMessagePipeHandle client_handle) override { - // TODO(vtl): This should be given a |const ConnectionContext&|, instead - // of an |ApplicationConnection*| -- which may be null! interface_request_handler_( - application_connection - ? application_connection->GetConnectionContext() - : ConnectionContext(), + connection_context, InterfaceRequest<Interface>(client_handle.Pass())); } @@ -132,6 +126,7 @@ void ConnectToService(const String& service_name, ScopedMessagePipeHandle client_handle) override; + ConnectionContext connection_context_; Binding<ServiceProvider> binding_; internal::ServiceConnectorRegistry service_connector_registry_;
diff --git a/mojo/public/cpp/application/tests/service_provider_impl_unittest.cc b/mojo/public/cpp/application/tests/service_provider_impl_unittest.cc index e0a4f12..a66f182 100644 --- a/mojo/public/cpp/application/tests/service_provider_impl_unittest.cc +++ b/mojo/public/cpp/application/tests/service_provider_impl_unittest.cc
@@ -54,23 +54,36 @@ }; TEST_F(ServiceProviderImplTest, Basic) { + const char kRemoteUrl[] = "https://example.com/remote.mojo"; + const char kConnectionUrl[] = "https://example.com/me.mojo"; + const char kPing1[] = "Ping1"; const char kPing2[] = "Ping2"; const char kPing3[] = "Ping3"; ServiceProviderPtr sp; - ServiceProviderImpl impl(GetProxy(&sp)); + ServiceProviderImpl impl(ConnectionContext(ConnectionContext::Type::INCOMING, + kRemoteUrl, kConnectionUrl), + GetProxy(&sp)); impl.AddServiceNew<test::PingService>( - [](const ConnectionContext& connection_context, - InterfaceRequest<test::PingService> ping_service_request) { + [&kRemoteUrl, &kConnectionUrl]( + const ConnectionContext& connection_context, + InterfaceRequest<test::PingService> ping_service_request) { + EXPECT_EQ(ConnectionContext::Type::INCOMING, connection_context.type); + EXPECT_EQ(kRemoteUrl, connection_context.remote_url); + EXPECT_EQ(kConnectionUrl, connection_context.connection_url); new PingServiceImpl(std::move(ping_service_request)); }, kPing1); impl.AddServiceNew<test::PingService>( - [](const ConnectionContext& connection_context, - InterfaceRequest<test::PingService> ping_service_request) { + [&kRemoteUrl, &kConnectionUrl]( + const ConnectionContext& connection_context, + InterfaceRequest<test::PingService> ping_service_request) { + EXPECT_EQ(ConnectionContext::Type::INCOMING, connection_context.type); + EXPECT_EQ(kRemoteUrl, connection_context.remote_url); + EXPECT_EQ(kConnectionUrl, connection_context.connection_url); new PingServiceImpl(std::move(ping_service_request)); }, kPing2); @@ -108,14 +121,24 @@ } TEST_F(ServiceProviderImplTest, CloseAndRebind) { + const char kRemoteUrl1[] = "https://example.com/remote1.mojo"; + const char kRemoteUrl2[] = "https://example.com/remote2.mojo"; + const char kConnectionUrl[] = "https://example.com/me.mojo"; const char kPing[] = "Ping"; ServiceProviderPtr sp1; - ServiceProviderImpl impl(GetProxy(&sp1)); + ServiceProviderImpl impl(ConnectionContext(ConnectionContext::Type::INCOMING, + kRemoteUrl1, kConnectionUrl), + GetProxy(&sp1)); impl.AddServiceNew<test::PingService>( - [](const ConnectionContext& connection_context, - InterfaceRequest<test::PingService> ping_service_request) { + [&kRemoteUrl1, &kRemoteUrl2, &kConnectionUrl]( + const ConnectionContext& connection_context, + InterfaceRequest<test::PingService> ping_service_request) { + EXPECT_EQ(ConnectionContext::Type::INCOMING, connection_context.type); + EXPECT_TRUE(connection_context.remote_url == kRemoteUrl1 || + connection_context.remote_url == kRemoteUrl2); + EXPECT_EQ(kConnectionUrl, connection_context.connection_url); new PingServiceImpl(std::move(ping_service_request)); }, kPing); @@ -134,7 +157,9 @@ loop().RunUntilIdle(); ServiceProviderPtr sp2; - impl.Bind(GetProxy(&sp2)); + impl.Bind(ConnectionContext(ConnectionContext::Type::INCOMING, kRemoteUrl2, + kConnectionUrl), + GetProxy(&sp2)); { test::PingServicePtr ping; @@ -153,16 +178,24 @@ } TEST_F(ServiceProviderImplTest, Bind) { + const char kRemoteUrl[] = "https://example.com/remote.mojo"; + const char kConnectionUrl[] = "https://example.com/me.mojo"; const char kPing[] = "Ping"; ServiceProviderPtr sp; ServiceProviderImpl impl; - impl.Bind(GetProxy(&sp)); + impl.Bind(ConnectionContext(ConnectionContext::Type::INCOMING, kRemoteUrl, + kConnectionUrl), + GetProxy(&sp)); impl.AddServiceNew<test::PingService>( - [](const ConnectionContext& connection_context, - InterfaceRequest<test::PingService> request) { + [&kRemoteUrl, &kConnectionUrl]( + const ConnectionContext& connection_context, + InterfaceRequest<test::PingService> request) { + EXPECT_EQ(ConnectionContext::Type::INCOMING, connection_context.type); + EXPECT_EQ(kRemoteUrl, connection_context.remote_url); + EXPECT_EQ(kConnectionUrl, connection_context.connection_url); new PingServiceImpl(std::move(request)); }, kPing); @@ -204,7 +237,10 @@ const char kWhatever[] = "Whatever"; ServiceProviderPtr sp; - ServiceProviderImpl impl(GetProxy(&sp)); + ServiceProviderImpl impl(ConnectionContext(ConnectionContext::Type::INCOMING, + "https://example.com/remote.mojo", + "https://example.com/me.mojo"), + GetProxy(&sp)); { test::PingServicePtr ping;
diff --git a/mojo/public/cpp/application/tests/service_registry_unittest.cc b/mojo/public/cpp/application/tests/service_registry_unittest.cc index e0c5a9d..304259e 100644 --- a/mojo/public/cpp/application/tests/service_registry_unittest.cc +++ b/mojo/public/cpp/application/tests/service_registry_unittest.cc
@@ -15,7 +15,7 @@ public: explicit TestConnector(int* delete_count) : delete_count_(delete_count) {} ~TestConnector() override { (*delete_count_)++; } - void ConnectToService(ApplicationConnection* application_connection, + void ConnectToService(const ConnectionContext& connection_context, const std::string& interface_name, ScopedMessagePipeHandle client_handle) override {}
diff --git a/mojo/public/cpp/bindings/tests/versioning_test_service.cc b/mojo/public/cpp/bindings/tests/versioning_test_service.cc index 419fa3a..893a47d 100644 --- a/mojo/public/cpp/bindings/tests/versioning_test_service.cc +++ b/mojo/public/cpp/bindings/tests/versioning_test_service.cc
@@ -106,7 +106,7 @@ } // InterfaceFactory<HumanResourceDatabase> implementation. - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<HumanResourceDatabase> request) override { // It will be deleted automatically when the underlying pipe encounters a // connection error.
diff --git a/mojo/ui/content_viewer_app.cc b/mojo/ui/content_viewer_app.cc index 6993082..42d3192 100644 --- a/mojo/ui/content_viewer_app.cc +++ b/mojo/ui/content_viewer_app.cc
@@ -54,10 +54,10 @@ } void ContentViewerApp::Create( - mojo::ApplicationConnection* connection, + const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<mojo::ContentHandler> request) { bindings_.AddBinding( - new DelegatingContentHandler(this, connection->GetConnectionURL()), + new DelegatingContentHandler(this, connection_context.connection_url), request.Pass()); }
diff --git a/mojo/ui/content_viewer_app.h b/mojo/ui/content_viewer_app.h index a45ebf9..990c900 100644 --- a/mojo/ui/content_viewer_app.h +++ b/mojo/ui/content_viewer_app.h
@@ -19,18 +19,17 @@ // TODO(jeffbrown): Support creating the view provider application in a // separate thread if desired (often not the case). This is one reason // we are not using the ContentHandlerFactory here. -class ContentViewerApp : public mojo::ApplicationDelegate, - public mojo::InterfaceFactory<mojo::ContentHandler> { +class ContentViewerApp : public ApplicationDelegate, + public InterfaceFactory<ContentHandler> { public: ContentViewerApp(); ~ContentViewerApp() override; - mojo::ApplicationImpl* app_impl() { return app_impl_; } + ApplicationImpl* app_impl() { return app_impl_; } // |ApplicationDelegate|: - void Initialize(mojo::ApplicationImpl* app) override; - bool ConfigureIncomingConnection( - mojo::ApplicationConnection* connection) override; + void Initialize(ApplicationImpl* app) override; + bool ConfigureIncomingConnection(ApplicationConnection* connection) override; // Called to create the view provider application to view the content. // @@ -46,22 +45,21 @@ // Returns the view provider application delegate to view the content, // or nullptr if the content could not be loaded. virtual ViewProviderApp* LoadContent(const std::string& content_handler_url, - mojo::URLResponsePtr response) = 0; + URLResponsePtr response) = 0; private: class DelegatingContentHandler; // |InterfaceFactory<ContentHandler>|: - void Create(mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<mojo::ContentHandler> request) override; + void Create(const ConnectionContext& connection_context, + InterfaceRequest<ContentHandler> request) override; - void StartViewer( - const std::string& content_handler_url, - mojo::InterfaceRequest<mojo::Application> application_request, - mojo::URLResponsePtr response); + void StartViewer(const std::string& content_handler_url, + InterfaceRequest<Application> application_request, + URLResponsePtr response); - mojo::ApplicationImpl* app_impl_ = nullptr; - mojo::StrongBindingSet<mojo::ContentHandler> bindings_; + ApplicationImpl* app_impl_ = nullptr; + StrongBindingSet<ContentHandler> bindings_; MOJO_DISALLOW_COPY_AND_ASSIGN(ContentViewerApp); };
diff --git a/mojo/ui/view_provider_app.cc b/mojo/ui/view_provider_app.cc index 432f00e..9df21e3 100644 --- a/mojo/ui/view_provider_app.cc +++ b/mojo/ui/view_provider_app.cc
@@ -57,10 +57,10 @@ } void ViewProviderApp::Create( - mojo::ApplicationConnection* connection, + const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<mojo::ui::ViewProvider> request) { bindings_.AddBinding( - new DelegatingViewProvider(this, connection->GetConnectionURL()), + new DelegatingViewProvider(this, connection_context.connection_url), request.Pass()); }
diff --git a/mojo/ui/view_provider_app.h b/mojo/ui/view_provider_app.h index a275540..147fb1b 100644 --- a/mojo/ui/view_provider_app.h +++ b/mojo/ui/view_provider_app.h
@@ -22,18 +22,17 @@ // // It is not necessary to use this class to implement all ViewProviders. // This class is merely intended to make the simple apps easier to write. -class ViewProviderApp : public mojo::ApplicationDelegate, - public mojo::InterfaceFactory<mojo::ui::ViewProvider> { +class ViewProviderApp : public ApplicationDelegate, + public InterfaceFactory<ui::ViewProvider> { public: ViewProviderApp(); ~ViewProviderApp() override; - mojo::ApplicationImpl* app_impl() { return app_impl_; } + ApplicationImpl* app_impl() { return app_impl_; } // |ApplicationDelegate|: - void Initialize(mojo::ApplicationImpl* app) override; - bool ConfigureIncomingConnection( - mojo::ApplicationConnection* connection) override; + void Initialize(ApplicationImpl* app) override; + bool ConfigureIncomingConnection(ApplicationConnection* connection) override; // Called by the ViewProvider to create a view. // This method may be called multiple times in the case where the @@ -51,26 +50,25 @@ // the view from the caller. virtual void CreateView( const std::string& view_provider_url, - mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, - mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services) = 0; + InterfaceRequest<ViewOwner> view_owner_request, + InterfaceRequest<ServiceProvider> services, + InterfaceHandle<ServiceProvider> exposed_services) = 0; private: class DelegatingViewProvider; - // |InterfaceFactory<mojo::ui::ViewProvider>|: - void Create(mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<mojo::ui::ViewProvider> request) override; + // |InterfaceFactory<ViewProvider>|: + void Create(const ConnectionContext& connection_context, + InterfaceRequest<ViewProvider> request) override; - void CreateView( - DelegatingViewProvider* provider, - const std::string& view_provider_url, - mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, - mojo::InterfaceRequest<mojo::ServiceProvider> services, - mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services); + void CreateView(DelegatingViewProvider* provider, + const std::string& view_provider_url, + InterfaceRequest<ViewOwner> view_owner_request, + InterfaceRequest<ServiceProvider> services, + InterfaceHandle<ServiceProvider> exposed_services); - mojo::ApplicationImpl* app_impl_ = nullptr; - mojo::StrongBindingSet<mojo::ui::ViewProvider> bindings_; + ApplicationImpl* app_impl_ = nullptr; + StrongBindingSet<ViewProvider> bindings_; MOJO_DISALLOW_COPY_AND_ASSIGN(ViewProviderApp); };
diff --git a/services/asset_bundle/main.cc b/services/asset_bundle/main.cc index ce98693..9d06e52 100644 --- a/services/asset_bundle/main.cc +++ b/services/asset_bundle/main.cc
@@ -28,7 +28,7 @@ } // |InterfaceFactory<AssetUnpacker>| implementation: - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<AssetUnpacker> request) override { // Lazily initialize |sequenced_worker_pool_|. (We can't create it in the // constructor, since AtExitManager is only created in
diff --git a/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_app.cc b/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_app.cc index 051b36f..9dcf03f 100644 --- a/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_app.cc +++ b/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_app.cc
@@ -29,9 +29,9 @@ } void AuthenticatingURLLoaderInterceptorApp::Create( - ApplicationConnection* connection, + const mojo::ConnectionContext& connection_context, InterfaceRequest<AuthenticatingURLLoaderInterceptorMetaFactory> request) { - GURL app_url(connection->GetRemoteApplicationURL()); + GURL app_url(connection_context.remote_url); GURL app_origin; if (app_url.is_valid()) { app_origin = app_url.GetOrigin();
diff --git a/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_app.h b/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_app.h index ddd98bf..10050fb 100644 --- a/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_app.h +++ b/services/authenticating_url_loader_interceptor/authenticating_url_loader_interceptor_app.h
@@ -27,7 +27,7 @@ bool ConfigureIncomingConnection(ApplicationConnection* connection) override; // InterfaceFactory<AuthenticatingURLLoaderInterceptorMetaFactory> - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<AuthenticatingURLLoaderInterceptorMetaFactory> request) override;
diff --git a/services/authentication/main.cc b/services/authentication/main.cc index 25c0140..bedd607 100644 --- a/services/authentication/main.cc +++ b/services/authentication/main.cc
@@ -39,7 +39,7 @@ return true; } - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<AuthenticationService> request) override { mojo::files::Error error = mojo::files::Error::INTERNAL; mojo::files::DirectoryPtr directory;
diff --git a/services/clipboard/main.cc b/services/clipboard/main.cc index 2a2a658..cdbb564 100644 --- a/services/clipboard/main.cc +++ b/services/clipboard/main.cc
@@ -23,7 +23,7 @@ } // mojo::InterfaceFactory<mojo::Clipboard> implementation. - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<mojo::Clipboard> request) override { // TODO(erg): Write native implementations of the clipboard. For now, we // just build a clipboard which doesn't interact with the system.
diff --git a/services/device_info/device_info.cc b/services/device_info/device_info.cc index 54fe54c..59cfe33 100644 --- a/services/device_info/device_info.cc +++ b/services/device_info/device_info.cc
@@ -19,9 +19,9 @@ // This is a native Mojo application which implements |DeviceInfo| interface for // Linux. -class DeviceInfo : public mojo::ApplicationDelegate, +class DeviceInfo : public ApplicationDelegate, public mojo::DeviceInfo, - public mojo::InterfaceFactory<mojo::DeviceInfo> { + public InterfaceFactory<mojo::DeviceInfo> { public: // We look for the 'DISPLAY' environment variable. If present, then we assume // it to be a desktop, else we assume it to be a commandline @@ -38,8 +38,8 @@ } // |InterfaceFactory<DeviceInfo>| implementation. - void Create(mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<mojo::DeviceInfo> request) override { + void Create(const ConnectionContext& connection_context, + InterfaceRequest<mojo::DeviceInfo> request) override { binding_.AddBinding(this, request.Pass()); }
diff --git a/services/files/files_impl.cc b/services/files/files_impl.cc index 94eb6cd..c6a8243 100644 --- a/services/files/files_impl.cc +++ b/services/files/files_impl.cc
@@ -19,7 +19,7 @@ #include "base/posix/eintr_wrapper.h" #include "base/sha1.h" #include "base/strings/string_number_conversions.h" -#include "mojo/public/cpp/application/application_connection.h" +#include "mojo/public/cpp/application/connection_context.h" #include "services/files/directory_impl.h" namespace mojo { @@ -99,9 +99,9 @@ } // namespace -FilesImpl::FilesImpl(ApplicationConnection* connection, +FilesImpl::FilesImpl(const ConnectionContext& connection_context, InterfaceRequest<Files> request) - : client_url_(connection->GetRemoteApplicationURL()), + : client_url_(connection_context.remote_url), binding_(this, request.Pass()) {} FilesImpl::~FilesImpl() {}
diff --git a/services/files/files_impl.h b/services/files/files_impl.h index eafb1fe..5094c68 100644 --- a/services/files/files_impl.h +++ b/services/files/files_impl.h
@@ -14,13 +14,14 @@ namespace mojo { -class ApplicationConnection; +struct ConnectionContext; namespace files { class FilesImpl : public Files { public: - FilesImpl(ApplicationConnection* connection, InterfaceRequest<Files> request); + FilesImpl(const ConnectionContext& connection_context, + InterfaceRequest<Files> request); ~FilesImpl() override; // |Files| implementation:
diff --git a/services/files/main.cc b/services/files/main.cc index 56101d9..b8a2ce0 100644 --- a/services/files/main.cc +++ b/services/files/main.cc
@@ -27,9 +27,9 @@ } // |InterfaceFactory<Files>| implementation: - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<Files> request) override { - new FilesImpl(connection, request.Pass()); + new FilesImpl(connection_context, request.Pass()); } DISALLOW_COPY_AND_ASSIGN(FilesApp);
diff --git a/services/gfx/compositor/compositor_app.cc b/services/gfx/compositor/compositor_app.cc index 5fd8a9a..a85b0f9 100644 --- a/services/gfx/compositor/compositor_app.cc +++ b/services/gfx/compositor/compositor_app.cc
@@ -41,7 +41,7 @@ } void CompositorApp::Create( - mojo::ApplicationConnection* connection, + const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<mojo::gfx::composition::Compositor> request) { compositor_bindings_.AddBinding(new CompositorImpl(engine_.get()), request.Pass());
diff --git a/services/gfx/compositor/compositor_app.h b/services/gfx/compositor/compositor_app.h index 1faaf11..51fab87 100644 --- a/services/gfx/compositor/compositor_app.h +++ b/services/gfx/compositor/compositor_app.h
@@ -33,7 +33,7 @@ mojo::ApplicationConnection* connection) override; // |InterfaceFactory<Compositor>|: - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<mojo::gfx::composition::Compositor> request) override;
diff --git a/services/http_server/http_server_app.cc b/services/http_server/http_server_app.cc index fa063fa..a1e6841 100644 --- a/services/http_server/http_server_app.cc +++ b/services/http_server/http_server_app.cc
@@ -32,7 +32,7 @@ } // InterfaceFactory<HttpServerFactory>: - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<HttpServerFactory> request) override { if (!http_server_factory_) { http_server_factory_.reset(new HttpServerFactoryImpl(app_));
diff --git a/services/icu_data/icu_data_impl.cc b/services/icu_data/icu_data_impl.cc index a3862a6..7192928 100644 --- a/services/icu_data/icu_data_impl.cc +++ b/services/icu_data/icu_data_impl.cc
@@ -29,7 +29,7 @@ } // mojo::InterfaceFactory<mojo::ICUData> implementation. - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection, mojo::InterfaceRequest<ICUData> request) override { bindings_.AddBinding(this, request.Pass()); }
diff --git a/services/keyboard/linux/main.cc b/services/keyboard/linux/main.cc index b74eaa7..397a4f2 100644 --- a/services/keyboard/linux/main.cc +++ b/services/keyboard/linux/main.cc
@@ -52,9 +52,8 @@ } // |InterfaceFactory<KeyboardService>| implementation: - void Create( - mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<KeyboardServiceFactory> request) override { + void Create(const mojo::ConnectionContext& connection_context, + mojo::InterfaceRequest<KeyboardServiceFactory> request) override { new KeyboardServiceFactoryImpl(request.Pass()); }
diff --git a/services/log/log_impl.cc b/services/log/log_impl.cc index b02459f..1bf505e 100644 --- a/services/log/log_impl.cc +++ b/services/log/log_impl.cc
@@ -8,7 +8,7 @@ #include "base/logging.h" #include "base/strings/stringprintf.h" -#include "mojo/public/cpp/application/application_connection.h" +#include "mojo/public/cpp/application/connection_context.h" #include "mojo/services/log/interfaces/entry.mojom.h" namespace mojo { @@ -47,13 +47,12 @@ LogImpl::~LogImpl() {} // static -void LogImpl::Create(ApplicationConnection* connection, +void LogImpl::Create(const ConnectionContext& connection_context, InterfaceRequest<Log> request, PrintLogMessageFunction print_log_message_function) { - DCHECK(connection); DCHECK(print_log_message_function); - const std::string& remote_url = connection->GetRemoteApplicationURL(); + const std::string& remote_url = connection_context.remote_url; if (remote_url.empty()) { LOG(ERROR) << "No remote URL."; return;
diff --git a/services/log/log_impl.h b/services/log/log_impl.h index 6a94ef2..7d92ef2 100644 --- a/services/log/log_impl.h +++ b/services/log/log_impl.h
@@ -16,7 +16,7 @@ namespace mojo { -class ApplicationConnection; +struct ConnectionContext; namespace log { @@ -34,7 +34,7 @@ // Note that |print_log_message_function| may be called many times, for the // lifetime of the created object. - static void Create(ApplicationConnection* connection, + static void Create(const ConnectionContext& connection_context, InterfaceRequest<Log> request, PrintLogMessageFunction print_log_message_function);
diff --git a/services/log/log_impl_unittest.cc b/services/log/log_impl_unittest.cc index 8500ce1..de6ff9b 100644 --- a/services/log/log_impl_unittest.cc +++ b/services/log/log_impl_unittest.cc
@@ -25,42 +25,16 @@ using base::MessageLoop; using LogImplTest = mojo::test::ApplicationTestBase; -// We need to supply a ApplicationConnection to LogImpl::Create(). -class TestApplicationConnection : public ApplicationConnection { - public: - TestApplicationConnection() - : connection_context_(ConnectionContext::Type::INCOMING, - "mojo:log_impl_unittest", - "mojo:log") {} - - const ConnectionContext& GetConnectionContext() const override { - return connection_context_; - } - - const std::string& GetConnectionURL() override { - return connection_context_.connection_url; - } - - const std::string& GetRemoteApplicationURL() override { - return connection_context_.remote_url; - } - - void SetServiceConnectorForName(ServiceConnector* service_connector, - const std::string& name) override {} - - private: - const ConnectionContext connection_context_; -}; - // Tests the Log service implementation by calling its AddEntry and verifying // the log message that it "prints". TEST_F(LogImplTest, AddEntryOutput) { std::vector<std::string> messages; LogPtr log; - TestApplicationConnection app_connection; + ConnectionContext connection_context(ConnectionContext::Type::INCOMING, + "mojo:log_impl_unittest", "mojo:log"); LogImpl::Create( - &app_connection, GetProxy(&log), + connection_context, GetProxy(&log), [&messages](const std::string& message) { messages.push_back(message); }); Entry entry;
diff --git a/services/log/main.cc b/services/log/main.cc index 23b8579..f87f0a3 100644 --- a/services/log/main.cc +++ b/services/log/main.cc
@@ -34,9 +34,9 @@ // |InterfaceFactory<Log>| implementation: // We maintain a separate |LogImpl| for each incoming connection. - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<Log> request) override { - LogImpl::Create(connection, std::move(request), + LogImpl::Create(connection_context, std::move(request), [](const std::string& message) { fprintf(stderr, "%s\n", message.c_str()); });
diff --git a/services/media/audio/audio_server_app.cc b/services/media/audio/audio_server_app.cc index 6a2a279..c59df0f 100644 --- a/services/media/audio/audio_server_app.cc +++ b/services/media/audio/audio_server_app.cc
@@ -31,7 +31,7 @@ void AudioServerApp::Quit() { } -void AudioServerApp::Create(ApplicationConnection* connection, +void AudioServerApp::Create(const ConnectionContext& connection_context, InterfaceRequest<AudioServer> request) { bindings_.AddBinding(&server_impl_, request.Pass()); }
diff --git a/services/media/audio/audio_server_app.h b/services/media/audio/audio_server_app.h index b67262a..c98cc30 100644 --- a/services/media/audio/audio_server_app.h +++ b/services/media/audio/audio_server_app.h
@@ -15,10 +15,9 @@ namespace media { namespace audio { -class AudioServerApp : public ApplicationDelegate - , public InterfaceFactory<AudioServer> { +class AudioServerApp : public ApplicationDelegate, + public InterfaceFactory<AudioServer> { public: - // Constructor/Destructor AudioServerApp(); ~AudioServerApp() override; @@ -28,12 +27,12 @@ void Quit() override; // InterfaceFactory<AudioServer> - void Create(mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<AudioServer> request) override; + void Create(const ConnectionContext& connection_context, + InterfaceRequest<AudioServer> request) override; private: - AudioServerImpl server_impl_; - BindingSet<AudioServer> bindings_; + AudioServerImpl server_impl_; + BindingSet<AudioServer> bindings_; }; } // namespace audio
diff --git a/services/media/factory_service/factory_service.cc b/services/media/factory_service/factory_service.cc index 4a17d82..d6be517 100644 --- a/services/media/factory_service/factory_service.cc +++ b/services/media/factory_service/factory_service.cc
@@ -34,7 +34,7 @@ return true; } -void MediaFactoryService::Create(ApplicationConnection* connection, +void MediaFactoryService::Create(const ConnectionContext& connection_context, InterfaceRequest<MediaFactory> request) { bindings_.AddBinding(this, request.Pass()); }
diff --git a/services/media/factory_service/factory_service.h b/services/media/factory_service/factory_service.h index 309a4ed..f115c5e 100644 --- a/services/media/factory_service/factory_service.h +++ b/services/media/factory_service/factory_service.h
@@ -80,7 +80,7 @@ bool ConfigureIncomingConnection(ApplicationConnection* connection) override; // InterfaceFactory<MediaFactory> implementation. - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<MediaFactory> request) override; // MediaFactory implementation.
diff --git a/services/nacl/nonsfi/pnacl_compile.cc b/services/nacl/nonsfi/pnacl_compile.cc index 38d5ef4..6985511 100644 --- a/services/nacl/nonsfi/pnacl_compile.cc +++ b/services/nacl/nonsfi/pnacl_compile.cc
@@ -54,7 +54,7 @@ } // From InterfaceFactory - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<PexeCompilerInit> request) override { new StrongBindingPexeCompilerImpl(request.Pass()); }
diff --git a/services/nacl/nonsfi/pnacl_link.cc b/services/nacl/nonsfi/pnacl_link.cc index 1e5e493..299a190 100644 --- a/services/nacl/nonsfi/pnacl_link.cc +++ b/services/nacl/nonsfi/pnacl_link.cc
@@ -51,7 +51,7 @@ } // From InterfaceFactory - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<PexeLinkerInit> request) override { new StrongBindingPexeLinkerImpl(request.Pass()); }
diff --git a/services/native_support/main.cc b/services/native_support/main.cc index 33aff04..11e8a7d 100644 --- a/services/native_support/main.cc +++ b/services/native_support/main.cc
@@ -37,13 +37,13 @@ } // |InterfaceFactory<Process>| implementation: - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<Process> request) override { if (!worker_pool_) { worker_pool_ = new base::SequencedWorkerPool(kMaxWorkerThreads, "NativeSupportWorker"); } - new ProcessImpl(worker_pool_, connection, request.Pass()); + new ProcessImpl(worker_pool_, connection_context, request.Pass()); } scoped_refptr<base::SequencedWorkerPool> worker_pool_;
diff --git a/services/native_support/process_impl.cc b/services/native_support/process_impl.cc index 4e72164..48cbd2c 100644 --- a/services/native_support/process_impl.cc +++ b/services/native_support/process_impl.cc
@@ -51,8 +51,9 @@ } // namespace +// TODO(vtl): This should do something with the |connection_context|. ProcessImpl::ProcessImpl(scoped_refptr<base::TaskRunner> worker_runner, - mojo::ApplicationConnection* connection, + const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<Process> request) : worker_runner_(worker_runner.Pass()), binding_(this, request.Pass()) {}
diff --git a/services/native_support/process_impl.h b/services/native_support/process_impl.h index 8632b2e..b734da2 100644 --- a/services/native_support/process_impl.h +++ b/services/native_support/process_impl.h
@@ -16,7 +16,7 @@ #include "mojo/services/native_support/interfaces/process.mojom.h" namespace mojo { -class ApplicationConnection; +struct ConnectionContext; } namespace native_support { @@ -26,7 +26,7 @@ class ProcessImpl : public Process { public: ProcessImpl(scoped_refptr<base::TaskRunner> worker_runner, - mojo::ApplicationConnection* connection, + const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<Process> request); ~ProcessImpl() override;
diff --git a/services/native_viewport/app_delegate.cc b/services/native_viewport/app_delegate.cc index 38ee403..67e5ecb 100644 --- a/services/native_viewport/app_delegate.cc +++ b/services/native_viewport/app_delegate.cc
@@ -59,23 +59,24 @@ } bool NativeViewportAppDelegate::ConfigureIncomingConnection( - ApplicationConnection* connection) { - connection->AddService<NativeViewport>(this); - connection->AddService<Gpu>(this); + mojo::ApplicationConnection* connection) { + connection->AddService<mojo::NativeViewport>(this); + connection->AddService<mojo::Gpu>(this); return true; } void NativeViewportAppDelegate::Create( - ApplicationConnection* connection, - mojo::InterfaceRequest<NativeViewport> request) { + const mojo::ConnectionContext& connection_context, + mojo::InterfaceRequest<mojo::NativeViewport> request) { if (!gpu_state_.get()) gpu_state_ = new gles2::GpuState; new NativeViewportImpl(application_, is_headless_, gpu_state_, request.Pass()); } -void NativeViewportAppDelegate::Create(ApplicationConnection* connection, - mojo::InterfaceRequest<Gpu> request) { +void NativeViewportAppDelegate::Create( + const mojo::ConnectionContext& connection_context, + mojo::InterfaceRequest<mojo::Gpu> request) { if (!gpu_state_.get()) gpu_state_ = new gles2::GpuState; new gles2::GpuImpl(request.Pass(), gpu_state_);
diff --git a/services/native_viewport/app_delegate.h b/services/native_viewport/app_delegate.h index fd651f3..2362355 100644 --- a/services/native_viewport/app_delegate.h +++ b/services/native_viewport/app_delegate.h
@@ -22,15 +22,12 @@ #include "ui/events/event_switches.h" #include "ui/gl/gl_surface.h" -using mojo::ApplicationConnection; -using mojo::Gpu; -using mojo::NativeViewport; - namespace native_viewport { -class NativeViewportAppDelegate : public mojo::ApplicationDelegate, - public mojo::InterfaceFactory<NativeViewport>, - public mojo::InterfaceFactory<Gpu> { +class NativeViewportAppDelegate + : public mojo::ApplicationDelegate, + public mojo::InterfaceFactory<mojo::NativeViewport>, + public mojo::InterfaceFactory<mojo::Gpu> { public: NativeViewportAppDelegate(); ~NativeViewportAppDelegate() override; @@ -38,15 +35,16 @@ // mojo::ApplicationDelegate implementation. void Initialize(mojo::ApplicationImpl* application) override; - bool ConfigureIncomingConnection(ApplicationConnection* connection) override; + bool ConfigureIncomingConnection( + mojo::ApplicationConnection* connection) override; - // mojo::InterfaceFactory<NativeViewport> implementation. - void Create(ApplicationConnection* connection, - mojo::InterfaceRequest<NativeViewport> request) override; + // mojo::InterfaceFactory<mojo::NativeViewport> implementation. + void Create(const mojo::ConnectionContext& connection_context, + mojo::InterfaceRequest<mojo::NativeViewport> request) override; - // mojo::InterfaceFactory<Gpu> implementation. - void Create(ApplicationConnection* connection, - mojo::InterfaceRequest<Gpu> request) override; + // mojo::InterfaceFactory<mojo::Gpu> implementation. + void Create(const mojo::ConnectionContext& connection_context, + mojo::InterfaceRequest<mojo::Gpu> request) override; private: void InitLogging(mojo::ApplicationImpl* application);
diff --git a/services/prediction/prediction_service_impl.cc b/services/prediction/prediction_service_impl.cc index ccc1596..210b965 100644 --- a/services/prediction/prediction_service_impl.cc +++ b/services/prediction/prediction_service_impl.cc
@@ -48,7 +48,7 @@ // mojo::InterfaceRequest<PredictionService> implementation void PredictionServiceDelegate::Create( - mojo::ApplicationConnection* connection, + const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<PredictionService> request) { new PredictionServiceImpl(request.Pass()); }
diff --git a/services/prediction/prediction_service_impl.h b/services/prediction/prediction_service_impl.h index 4963004..64e2b50 100644 --- a/services/prediction/prediction_service_impl.h +++ b/services/prediction/prediction_service_impl.h
@@ -41,7 +41,7 @@ mojo::ApplicationConnection* connection) override; // mojo::InterfaceRequest<PredictionService> implementation - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<PredictionService> request) override; };
diff --git a/services/test_service/test_request_tracker_application.cc b/services/test_service/test_request_tracker_application.cc index 6cfd204..ed23d44 100644 --- a/services/test_service/test_request_tracker_application.cc +++ b/services/test_service/test_request_tracker_application.cc
@@ -36,19 +36,19 @@ } void TestRequestTrackerApplication::Create( - ApplicationConnection* connection, + const ConnectionContext& connection_context, InterfaceRequest<TestTimeService> request) { new TestTimeServiceImpl(app_impl_, request.Pass()); } void TestRequestTrackerApplication::Create( - ApplicationConnection* connection, + const ConnectionContext& connection_context, InterfaceRequest<TestRequestTracker> request) { new TestRequestTrackerImpl(request.Pass(), &context_); } void TestRequestTrackerApplication::Create( - ApplicationConnection* connection, + const ConnectionContext& connection_context, InterfaceRequest<TestTrackedRequestService> request) { new TestTrackedRequestServiceImpl(request.Pass(), &context_); }
diff --git a/services/test_service/test_request_tracker_application.h b/services/test_service/test_request_tracker_application.h index 6fe057d..c169c90 100644 --- a/services/test_service/test_request_tracker_application.h +++ b/services/test_service/test_request_tracker_application.h
@@ -31,15 +31,15 @@ bool ConfigureIncomingConnection(ApplicationConnection* connection) override; // InterfaceFactory<TestTimeService> methods: - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<TestTimeService> request) override; // InterfaceFactory<TestRequestTracker> methods: - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<TestRequestTracker> request) override; // InterfaceFactory<TestTrackedRequestService> methods: - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<TestTrackedRequestService> request) override; private:
diff --git a/services/test_service/test_service_application.cc b/services/test_service/test_service_application.cc index b288d98..509ddac 100644 --- a/services/test_service/test_service_application.cc +++ b/services/test_service/test_service_application.cc
@@ -34,13 +34,13 @@ return true; } -void TestServiceApplication::Create(ApplicationConnection* connection, +void TestServiceApplication::Create(const ConnectionContext& connection_context, InterfaceRequest<TestService> request) { new TestServiceImpl(app_impl_, this, request.Pass()); AddRef(); } -void TestServiceApplication::Create(ApplicationConnection* connection, +void TestServiceApplication::Create(const ConnectionContext& connection_context, InterfaceRequest<TestTimeService> request) { new TestTimeServiceImpl(app_impl_, request.Pass()); }
diff --git a/services/test_service/test_service_application.h b/services/test_service/test_service_application.h index 6b36f07..1839311 100644 --- a/services/test_service/test_service_application.h +++ b/services/test_service/test_service_application.h
@@ -29,11 +29,11 @@ bool ConfigureIncomingConnection(ApplicationConnection* connection) override; // InterfaceFactory<TestService> implementation. - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<TestService> request) override; // InterfaceFactory<TestTimeService> implementation. - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<TestTimeService> request) override; void AddRef();
diff --git a/services/tracing/tracing_app.cc b/services/tracing/tracing_app.cc index 036e583..915ed03 100644 --- a/services/tracing/tracing_app.cc +++ b/services/tracing/tracing_app.cc
@@ -21,7 +21,7 @@ return true; } -void TracingApp::Create(mojo::ApplicationConnection* connection, +void TracingApp::Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<TraceCollector> request) { if (collector_binding_.is_bound()) { LOG(ERROR) << "Another application is already connected to tracing."; @@ -31,7 +31,7 @@ collector_binding_.Bind(request.Pass()); } -void TracingApp::Create(mojo::ApplicationConnection* connection, +void TracingApp::Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<TraceProviderRegistry> request) { provider_registry_bindings_.AddBinding(this, request.Pass()); }
diff --git a/services/tracing/tracing_app.h b/services/tracing/tracing_app.h index 3131c55..24395e0 100644 --- a/services/tracing/tracing_app.h +++ b/services/tracing/tracing_app.h
@@ -35,11 +35,11 @@ mojo::ApplicationConnection* connection) override; // mojo::InterfaceFactory<TraceCollector> implementation. - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<TraceCollector> request) override; // mojo::InterfaceFactory<TraceProviderRegistry> implementation. - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<TraceProviderRegistry> request) override; // TraceCollector implementation.
diff --git a/services/ui/input_manager/input_manager_app.cc b/services/ui/input_manager/input_manager_app.cc index 9c5db14..b6adffb 100644 --- a/services/ui/input_manager/input_manager_app.cc +++ b/services/ui/input_manager/input_manager_app.cc
@@ -39,7 +39,7 @@ } void InputManagerApp::Create( - mojo::ApplicationConnection* connection, + const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<mojo::ui::ViewAssociate> request) { input_associates.AddBinding(new InputAssociate(), request.Pass()); }
diff --git a/services/ui/input_manager/input_manager_app.h b/services/ui/input_manager/input_manager_app.h index e7c424a..764487b 100644 --- a/services/ui/input_manager/input_manager_app.h +++ b/services/ui/input_manager/input_manager_app.h
@@ -30,7 +30,7 @@ mojo::ApplicationConnection* connection) override; // |InterfaceFactory<ViewAssociate>|: - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<mojo::ui::ViewAssociate> request) override; mojo::ApplicationImpl* app_impl_;
diff --git a/services/ui/launcher/launcher_app.cc b/services/ui/launcher/launcher_app.cc index 895f2e1..918681e 100644 --- a/services/ui/launcher/launcher_app.cc +++ b/services/ui/launcher/launcher_app.cc
@@ -45,7 +45,7 @@ return true; } -void LauncherApp::Create(mojo::ApplicationConnection* connection, +void LauncherApp::Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<Launcher> request) { bindings_.AddBinding(this, request.Pass()); }
diff --git a/services/ui/launcher/launcher_app.h b/services/ui/launcher/launcher_app.h index 6eddc7d..153641d 100644 --- a/services/ui/launcher/launcher_app.h +++ b/services/ui/launcher/launcher_app.h
@@ -30,7 +30,7 @@ mojo::ApplicationConnection* connection) override; // mojo::InterfaceRequest<Launcher> implementation - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<Launcher> request) override; // |Launcher|:
diff --git a/services/ui/view_manager/view_manager_app.cc b/services/ui/view_manager/view_manager_app.cc index a77b49a..63ebbba 100644 --- a/services/ui/view_manager/view_manager_app.cc +++ b/services/ui/view_manager/view_manager_app.cc
@@ -66,7 +66,7 @@ } void ViewManagerApp::Create( - mojo::ApplicationConnection* connection, + const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<mojo::ui::ViewManager> request) { DCHECK(registry_); view_managers_.AddBinding(new ViewManagerImpl(registry_.get()),
diff --git a/services/ui/view_manager/view_manager_app.h b/services/ui/view_manager/view_manager_app.h index 96cbab4..2088435 100644 --- a/services/ui/view_manager/view_manager_app.h +++ b/services/ui/view_manager/view_manager_app.h
@@ -31,7 +31,7 @@ mojo::ApplicationConnection* connection) override; // |InterfaceFactory<ViewManager>|: - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<mojo::ui::ViewManager> request) override; void OnCompositorConnectionError();
diff --git a/services/url_response_disk_cache/url_response_disk_cache_app.cc b/services/url_response_disk_cache/url_response_disk_cache_app.cc index ba7b456..e63d15f 100644 --- a/services/url_response_disk_cache/url_response_disk_cache_app.cc +++ b/services/url_response_disk_cache/url_response_disk_cache_app.cc
@@ -30,11 +30,10 @@ } void URLResponseDiskCacheApp::Create( - ApplicationConnection* connection, + const ConnectionContext& connection_context, InterfaceRequest<URLResponseDiskCache> request) { new URLResponseDiskCacheImpl(task_runner_, delegate_, db_, - connection->GetRemoteApplicationURL(), - request.Pass()); + connection_context.remote_url, request.Pass()); } } // namespace mojo
diff --git a/services/url_response_disk_cache/url_response_disk_cache_app.h b/services/url_response_disk_cache/url_response_disk_cache_app.h index 776db21..7e0715c 100644 --- a/services/url_response_disk_cache/url_response_disk_cache_app.h +++ b/services/url_response_disk_cache/url_response_disk_cache_app.h
@@ -32,7 +32,7 @@ bool ConfigureIncomingConnection(ApplicationConnection* connection) override; // InterfaceFactory<URLResponseDiskCache>: - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<URLResponseDiskCache> request) override; scoped_refptr<base::TaskRunner> task_runner_;
diff --git a/shell/android/native_viewport_application_loader.cc b/shell/android/native_viewport_application_loader.cc index 34450a9..ea9bc9b 100644 --- a/shell/android/native_viewport_application_loader.cc +++ b/shell/android/native_viewport_application_loader.cc
@@ -9,6 +9,7 @@ #include "services/native_viewport/native_viewport_impl.h" using mojo::ApplicationConnection; +using mojo::ConnectionContext; using mojo::InterfaceRequest; namespace shell { @@ -34,7 +35,7 @@ } void NativeViewportApplicationLoader::Create( - ApplicationConnection* connection, + const ConnectionContext& connection_context, InterfaceRequest<mojo::NativeViewport> request) { if (!gpu_state_) gpu_state_ = new gles2::GpuState; @@ -43,7 +44,7 @@ } void NativeViewportApplicationLoader::Create( - ApplicationConnection* connection, + const ConnectionContext& connection_context, InterfaceRequest<mojo::Gpu> request) { if (!gpu_state_) gpu_state_ = new gles2::GpuState;
diff --git a/shell/android/native_viewport_application_loader.h b/shell/android/native_viewport_application_loader.h index 8e62420..861a691 100644 --- a/shell/android/native_viewport_application_loader.h +++ b/shell/android/native_viewport_application_loader.h
@@ -42,11 +42,11 @@ mojo::ApplicationConnection* connection) override; // mojo::InterfaceFactory<mojo::NativeViewport> implementation. - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<mojo::NativeViewport> request) override; // mojo::InterfaceFactory<mojo::Gpu> implementation. - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<mojo::Gpu> request) override; scoped_refptr<gles2::GpuState> gpu_state_;
diff --git a/shell/application_manager/application_manager_unittest.cc b/shell/application_manager/application_manager_unittest.cc index aa1f7ae..7dec43d 100644 --- a/shell/application_manager/application_manager_unittest.cc +++ b/shell/application_manager/application_manager_unittest.cc
@@ -27,6 +27,7 @@ using mojo::ApplicationDelegate; using mojo::ApplicationImpl; using mojo::Callback; +using mojo::ConnectionContext; using mojo::InterfaceFactory; using mojo::InterfaceRequest; using mojo::StrongBinding; @@ -129,7 +130,7 @@ } // InterfaceFactory implementation. - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<TestService> request) override { new TestServiceImpl(context_, request.Pass()); } @@ -277,9 +278,7 @@ class TestBImpl : public TestB { public: - TestBImpl(ApplicationConnection* connection, - TesterContext* test_context, - InterfaceRequest<TestB> request) + TestBImpl(TesterContext* test_context, InterfaceRequest<TestB> request) : test_context_(test_context), binding_(this, request.Pass()) {} ~TestBImpl() override { @@ -330,7 +329,7 @@ return true; } - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<TestA> request) override { mojo::InterfaceHandle<mojo::ServiceProvider> incoming_sp_handle; app_->shell()->ConnectToApplication(kTestBURLString, @@ -339,9 +338,9 @@ new TestAImpl(incoming_sp_handle.Pass(), context_, request.Pass())); } - void Create(ApplicationConnection* connection, + void Create(const ConnectionContext& connection_context, InterfaceRequest<TestB> request) override { - new TestBImpl(connection, context_, request.Pass()); + new TestBImpl(context_, request.Pass()); } TesterContext* context_;
diff --git a/shell/test/pingable_app.cc b/shell/test/pingable_app.cc index f65b682..2436a7d 100644 --- a/shell/test/pingable_app.cc +++ b/shell/test/pingable_app.cc
@@ -58,9 +58,10 @@ } // InterfaceFactory<Pingable>: - void Create(mojo::ApplicationConnection* connection, + void Create(const mojo::ConnectionContext& connection_context, mojo::InterfaceRequest<Pingable> request) override { - new PingableImpl(request.Pass(), app_url_, connection->GetConnectionURL()); + new PingableImpl(request.Pass(), app_url_, + connection_context.connection_url); } std::string app_url_;
diff --git a/ui/ozone/platform/drm/mojo/drm_ipc_init_helper.cc b/ui/ozone/platform/drm/mojo/drm_ipc_init_helper.cc index aa486c6..ecbd1a9 100644 --- a/ui/ozone/platform/drm/mojo/drm_ipc_init_helper.cc +++ b/ui/ozone/platform/drm/mojo/drm_ipc_init_helper.cc
@@ -17,29 +17,21 @@ class InterfaceFactoryDrmHost : public mojo::InterfaceFactory<mojo::OzoneDrmHost> { // mojo::InterfaceFactory implementation. - void Create(mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<mojo::OzoneDrmHost> request) override; + void Create(const mojo::ConnectionContext& connection_context, + mojo::InterfaceRequest<mojo::OzoneDrmHost> request) override { + new MojoDrmHostImpl(request.Pass()); + } }; class InterfaceFactoryDrmGpu : public mojo::InterfaceFactory<mojo::OzoneDrmGpu> { // mojo::InterfaceFactory<OzoneDrmGpu> implementation. - void Create(mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<mojo::OzoneDrmGpu> request) override; + void Create(const mojo::ConnectionContext& connection_context, + mojo::InterfaceRequest<mojo::OzoneDrmGpu> request) override { + new MojoDrmGpuImpl(request.Pass()); + } }; -void InterfaceFactoryDrmHost::Create( - mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<mojo::OzoneDrmHost> request) { - new MojoDrmHostImpl(request.Pass()); -} - -void InterfaceFactoryDrmGpu::Create( - mojo::ApplicationConnection* connection, - mojo::InterfaceRequest<mojo::OzoneDrmGpu> request) { - new MojoDrmGpuImpl(request.Pass()); -} - class DrmIpcInitHelperMojo : public IpcInitHelperMojo { public: DrmIpcInitHelperMojo();