diff options
author | ben <ben@chromium.org> | 2016-02-06 00:56:49 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-06 08:57:33 +0000 |
commit | 9aaf303247f22bb0ad2a2eea88126e547e54d41f (patch) | |
tree | 556faeb80ff3d240a0f0d1b9827cfc90354c3078 /mojo/shell/public | |
parent | 96c6854b0d976412cc1e7f827c97c3ee1d81cd20 (diff) | |
download | chromium_src-9aaf303247f22bb0ad2a2eea88126e547e54d41f.zip chromium_src-9aaf303247f22bb0ad2a2eea88126e547e54d41f.tar.gz chromium_src-9aaf303247f22bb0ad2a2eea88126e547e54d41f.tar.bz2 |
Move shell interfaces into the shell.mojom namespace.
TBR=rockot@chromium.org
R=palmer@chromium.org
BUG=none
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation
Review URL: https://codereview.chromium.org/1679573002
Cr-Commit-Position: refs/heads/master@{#374022}
Diffstat (limited to 'mojo/shell/public')
-rw-r--r-- | mojo/shell/public/cpp/application_impl.h | 40 | ||||
-rw-r--r-- | mojo/shell/public/cpp/content_handler_factory.h | 14 | ||||
-rw-r--r-- | mojo/shell/public/cpp/lib/application_impl.cc | 33 | ||||
-rw-r--r-- | mojo/shell/public/cpp/lib/application_runner.cc | 5 | ||||
-rw-r--r-- | mojo/shell/public/cpp/lib/application_test_base.cc | 17 | ||||
-rw-r--r-- | mojo/shell/public/cpp/lib/content_handler_factory.cc | 19 | ||||
-rw-r--r-- | mojo/shell/public/cpp/lib/service_registry.cc | 2 | ||||
-rw-r--r-- | mojo/shell/public/cpp/lib/service_registry.h | 3 | ||||
-rw-r--r-- | mojo/shell/public/interfaces/application.mojom | 6 | ||||
-rw-r--r-- | mojo/shell/public/interfaces/application_manager.mojom | 2 | ||||
-rw-r--r-- | mojo/shell/public/interfaces/content_handler.mojom | 4 | ||||
-rw-r--r-- | mojo/shell/public/interfaces/shell.mojom | 8 |
12 files changed, 86 insertions, 67 deletions
diff --git a/mojo/shell/public/cpp/application_impl.h b/mojo/shell/public/cpp/application_impl.h index 662cfda..8cbda21 100644 --- a/mojo/shell/public/cpp/application_impl.h +++ b/mojo/shell/public/cpp/application_impl.h @@ -23,7 +23,9 @@ namespace mojo { -CapabilityFilterPtr CreatePermissiveCapabilityFilter(); +shell::mojom::CapabilityFilterPtr CreatePermissiveCapabilityFilter(); + +using ApplicationRequest = InterfaceRequest<shell::mojom::Application>; // TODO(beng): This comment is hilariously out of date. // Utility class for communicating with the Shell, and providing Services @@ -59,7 +61,7 @@ CapabilityFilterPtr CreatePermissiveCapabilityFilter(); // app.AddService<BarImpl>(&context); // // -class ApplicationImpl : public Application { +class ApplicationImpl : public shell::mojom::Application { public: class ConnectParams { public: @@ -68,12 +70,16 @@ class ApplicationImpl : public Application { ~ConnectParams(); URLRequestPtr TakeRequest() { return std::move(request_); } - CapabilityFilterPtr TakeFilter() { return std::move(filter_); } - void set_filter(CapabilityFilterPtr filter) { filter_ = std::move(filter); } + shell::mojom::CapabilityFilterPtr TakeFilter() { + return std::move(filter_); + } + void set_filter(shell::mojom::CapabilityFilterPtr filter) { + filter_ = std::move(filter); + } private: URLRequestPtr request_; - CapabilityFilterPtr filter_; + shell::mojom::CapabilityFilterPtr filter_; DISALLOW_COPY_AND_ASSIGN(ConnectParams); }; @@ -83,8 +89,9 @@ class ApplicationImpl : public Application { explicit TestApi(ApplicationImpl* application) : application_(application) {} - void UnbindConnections(InterfaceRequest<Application>* application_request, - ShellPtr* shell) { + void UnbindConnections( + InterfaceRequest<shell::mojom::Application>* application_request, + shell::mojom::ShellPtr* shell) { application_->UnbindConnections(application_request, shell); } @@ -95,19 +102,19 @@ class ApplicationImpl : public Application { // Does not take ownership of |delegate|, which must remain valid for the // lifetime of ApplicationImpl. ApplicationImpl(ApplicationDelegate* delegate, - InterfaceRequest<Application> request); + InterfaceRequest<shell::mojom::Application> request); // Constructs an ApplicationImpl with a custom termination closure. This // closure is invoked on Quit() instead of the default behavior of quitting // the current base::MessageLoop. ApplicationImpl(ApplicationDelegate* delegate, - InterfaceRequest<Application> request, + InterfaceRequest<shell::mojom::Application> request, const Closure& termination_closure); ~ApplicationImpl() override; // The Mojo shell. This will return a valid pointer after Initialize() has // been invoked. It will remain valid until UnbindConnections() is invoked or // the ApplicationImpl is destroyed. - Shell* shell() const { return shell_.get(); } + shell::mojom::Shell* shell() const { return shell_.get(); } const std::string& url() const { return url_; } uint32_t id() const { return id_; } @@ -146,8 +153,8 @@ class ApplicationImpl : public Application { void Quit(); private: - // Application implementation. - void Initialize(ShellPtr shell, + // shell::mojom::Application implementation. + void Initialize(shell::mojom::ShellPtr shell, const mojo::String& url, uint32_t id) override; void AcceptConnection(const String& requestor_url, @@ -167,15 +174,16 @@ class ApplicationImpl : public Application { // Unbinds the Shell and Application connections. Can be used to re-bind the // handles to another implementation of ApplicationImpl, for instance when // running apptests. - void UnbindConnections(InterfaceRequest<Application>* application_request, - ShellPtr* shell); + void UnbindConnections( + InterfaceRequest<shell::mojom::Application>* application_request, + shell::mojom::ShellPtr* shell); // We track the lifetime of incoming connection registries as it more // convenient for the client. ScopedVector<ApplicationConnection> incoming_connections_; ApplicationDelegate* delegate_; - Binding<Application> binding_; - ShellPtr shell_; + Binding<shell::mojom::Application> binding_; + shell::mojom::ShellPtr shell_; std::string url_; uint32_t id_; Closure termination_closure_; diff --git a/mojo/shell/public/cpp/content_handler_factory.h b/mojo/shell/public/cpp/content_handler_factory.h index 4bcb81e..a8aa8c3 100644 --- a/mojo/shell/public/cpp/content_handler_factory.h +++ b/mojo/shell/public/cpp/content_handler_factory.h @@ -14,7 +14,8 @@ namespace mojo { -class ContentHandlerFactory : public InterfaceFactory<ContentHandler> { +class ContentHandlerFactory + : public InterfaceFactory<shell::mojom::ContentHandler> { public: class HandledApplicationHolder { public: @@ -27,7 +28,7 @@ class ContentHandlerFactory : public InterfaceFactory<ContentHandler> { // Implement this method to create the Application. This method will be // called on a new thread. Leaving this method will quit the application. virtual void RunApplication( - InterfaceRequest<Application> application_request, + InterfaceRequest<shell::mojom::Application> application_request, URLResponsePtr response) = 0; }; @@ -39,12 +40,13 @@ class ContentHandlerFactory : public InterfaceFactory<ContentHandler> { // on this new thread, and the returned value will be kept alive until the // application ends. virtual scoped_ptr<HandledApplicationHolder> CreateApplication( - InterfaceRequest<Application> application_request, + InterfaceRequest<shell::mojom::Application> application_request, URLResponsePtr response) = 0; private: - void RunApplication(InterfaceRequest<Application> application_request, - URLResponsePtr response) override; + void RunApplication( + InterfaceRequest<shell::mojom::Application> application_request, + URLResponsePtr response) override; }; explicit ContentHandlerFactory(Delegate* delegate); @@ -53,7 +55,7 @@ class ContentHandlerFactory : public InterfaceFactory<ContentHandler> { private: // From InterfaceFactory: void Create(ApplicationConnection* connection, - InterfaceRequest<ContentHandler> request) override; + InterfaceRequest<shell::mojom::ContentHandler> request) override; Delegate* delegate_; diff --git a/mojo/shell/public/cpp/lib/application_impl.cc b/mojo/shell/public/cpp/lib/application_impl.cc index 5c40fe6..2769f6e 100644 --- a/mojo/shell/public/cpp/lib/application_impl.cc +++ b/mojo/shell/public/cpp/lib/application_impl.cc @@ -29,23 +29,26 @@ void DefaultTerminationClosure() { ApplicationImpl::ConnectParams::ConnectParams(const std::string& url) : ConnectParams(URLRequest::From(url)) {} ApplicationImpl::ConnectParams::ConnectParams(URLRequestPtr request) - : request_(std::move(request)), filter_(CapabilityFilter::New()) { + : request_(std::move(request)), + filter_(shell::mojom::CapabilityFilter::New()) { filter_->filter.mark_non_null(); } ApplicationImpl::ConnectParams::~ConnectParams() {} -ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate, - InterfaceRequest<Application> request) +ApplicationImpl::ApplicationImpl( + ApplicationDelegate* delegate, + InterfaceRequest<shell::mojom::Application> request) : ApplicationImpl(delegate, std::move(request), base::Bind(&DefaultTerminationClosure)) {} -ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate, - InterfaceRequest<Application> request, - const Closure& termination_closure) +ApplicationImpl::ApplicationImpl( + ApplicationDelegate* delegate, + InterfaceRequest<shell::mojom::Application> request, + const Closure& termination_closure) : delegate_(delegate), binding_(this, std::move(request)), - id_(Shell::kInvalidApplicationID), + id_(shell::mojom::Shell::kInvalidApplicationID), termination_closure_(termination_closure), app_lifetime_helper_(this), quit_requested_(false), @@ -81,8 +84,9 @@ scoped_ptr<ApplicationConnection> InterfaceRequest<ServiceProvider> remote_services_proxy = GetProxy(&remote_services); scoped_ptr<internal::ServiceRegistry> registry(new internal::ServiceRegistry( - application_url, application_url, Shell::kInvalidApplicationID, - std::move(remote_services), std::move(local_request), allowed)); + application_url, application_url, + shell::mojom::Shell::kInvalidApplicationID, std::move(remote_services), + std::move(local_request), allowed)); shell_->ConnectToApplication(std::move(request), std::move(remote_services_proxy), std::move(local_services), params->TakeFilter(), @@ -106,7 +110,7 @@ void ApplicationImpl::Quit() { } } -void ApplicationImpl::Initialize(ShellPtr shell, +void ApplicationImpl::Initialize(shell::mojom::ShellPtr shell, const mojo::String& url, uint32_t id) { shell_ = std::move(shell); @@ -167,14 +171,15 @@ void ApplicationImpl::QuitNow() { } void ApplicationImpl::UnbindConnections( - InterfaceRequest<Application>* application_request, - ShellPtr* shell) { + InterfaceRequest<shell::mojom::Application>* application_request, + shell::mojom::ShellPtr* shell) { *application_request = binding_.Unbind(); shell->Bind(shell_.PassInterface()); } -CapabilityFilterPtr CreatePermissiveCapabilityFilter() { - CapabilityFilterPtr filter(CapabilityFilter::New()); +shell::mojom::CapabilityFilterPtr CreatePermissiveCapabilityFilter() { + shell::mojom::CapabilityFilterPtr filter( + shell::mojom::CapabilityFilter::New()); Array<String> all_interfaces; all_interfaces.push_back("*"); filter->filter.insert("*", std::move(all_interfaces)); diff --git a/mojo/shell/public/cpp/lib/application_runner.cc b/mojo/shell/public/cpp/lib/application_runner.cc index 02380c6..e95133e 100644 --- a/mojo/shell/public/cpp/lib/application_runner.cc +++ b/mojo/shell/public/cpp/lib/application_runner.cc @@ -55,8 +55,9 @@ MojoResult ApplicationRunner::Run(MojoHandle application_request_handle, loop.reset(new base::MessageLoop(message_loop_type_)); ApplicationImpl impl(delegate_.get(), - MakeRequest<Application>(MakeScopedHandle( - MessagePipeHandle(application_request_handle)))); + MakeRequest<shell::mojom::Application>( + MakeScopedHandle(MessagePipeHandle( + application_request_handle)))); loop->Run(); // It's very common for the delegate to cache the app and terminate on // errors. If we don't delete the delegate before the app we run the risk diff --git a/mojo/shell/public/cpp/lib/application_test_base.cc b/mojo/shell/public/cpp/lib/application_test_base.cc index c9d08c1..377220e 100644 --- a/mojo/shell/public/cpp/lib/application_test_base.cc +++ b/mojo/shell/public/cpp/lib/application_test_base.cc @@ -19,20 +19,21 @@ namespace test { namespace { // Share the application URL with multiple application tests. String g_url; -uint32_t g_id = Shell::kInvalidApplicationID; +uint32_t g_id = shell::mojom::Shell::kInvalidApplicationID; // Application request handle passed from the shell in MojoMain, stored in // between SetUp()/TearDown() so we can (re-)intialize new ApplicationImpls. -InterfaceRequest<Application> g_application_request; +InterfaceRequest<shell::mojom::Application> g_application_request; // Shell pointer passed in the initial mojo.Application.Initialize() call, // stored in between initial setup and the first test and between SetUp/TearDown // calls so we can (re-)initialize new ApplicationImpls. -ShellPtr g_shell; +shell::mojom::ShellPtr g_shell; -class ShellGrabber : public Application { +class ShellGrabber : public shell::mojom::Application { public: - explicit ShellGrabber(InterfaceRequest<Application> application_request) + explicit ShellGrabber( + InterfaceRequest<shell::mojom::Application> application_request) : binding_(this, std::move(application_request)) {} void WaitForInitialize() { @@ -42,7 +43,7 @@ class ShellGrabber : public Application { private: // Application implementation. - void Initialize(ShellPtr shell, + void Initialize(shell::mojom::ShellPtr shell, const mojo::String& url, uint32_t id) override { g_url = url; @@ -76,7 +77,7 @@ MojoResult RunAllTests(MojoHandle application_request_handle) { // Grab the shell handle. ShellGrabber grabber( - MakeRequest<Application>(MakeScopedHandle( + MakeRequest<shell::mojom::Application>(MakeScopedHandle( MessagePipeHandle(application_request_handle)))); grabber.WaitForInitialize(); MOJO_CHECK(g_shell); @@ -117,7 +118,7 @@ TestHelper::TestHelper(ApplicationDelegate* delegate) delegate == nullptr ? &default_application_delegate_ : delegate, std::move(g_application_request))) { // Fake application initialization. - Application* application = application_impl_.get(); + shell::mojom::Application* application = application_impl_.get(); application->Initialize(std::move(g_shell), g_url, g_id); } diff --git a/mojo/shell/public/cpp/lib/content_handler_factory.cc b/mojo/shell/public/cpp/lib/content_handler_factory.cc index c810354..c713f24 100644 --- a/mojo/shell/public/cpp/lib/content_handler_factory.cc +++ b/mojo/shell/public/cpp/lib/content_handler_factory.cc @@ -31,7 +31,7 @@ class ApplicationThread : public base::PlatformThread::Delegate { scoped_refptr<base::SingleThreadTaskRunner> handler_thread, const base::Callback<void(ApplicationThread*)>& termination_callback, ContentHandlerFactory::Delegate* handler_delegate, - InterfaceRequest<Application> application_request, + InterfaceRequest<shell::mojom::Application> application_request, URLResponsePtr response, const Callback<void()>& destruct_callback) : handler_thread_(handler_thread), @@ -56,17 +56,17 @@ class ApplicationThread : public base::PlatformThread::Delegate { scoped_refptr<base::SingleThreadTaskRunner> handler_thread_; base::Callback<void(ApplicationThread*)> termination_callback_; ContentHandlerFactory::Delegate* handler_delegate_; - InterfaceRequest<Application> application_request_; + InterfaceRequest<shell::mojom::Application> application_request_; URLResponsePtr response_; Callback<void()> destruct_callback_; DISALLOW_COPY_AND_ASSIGN(ApplicationThread); }; -class ContentHandlerImpl : public ContentHandler { +class ContentHandlerImpl : public shell::mojom::ContentHandler { public: ContentHandlerImpl(ContentHandlerFactory::Delegate* delegate, - InterfaceRequest<ContentHandler> request) + InterfaceRequest<shell::mojom::ContentHandler> request) : delegate_(delegate), binding_(this, std::move(request)), weak_factory_(this) {} @@ -85,7 +85,7 @@ class ContentHandlerImpl : public ContentHandler { private: // Overridden from ContentHandler: void StartApplication( - InterfaceRequest<Application> application_request, + InterfaceRequest<shell::mojom::Application> application_request, URLResponsePtr response, const Callback<void()>& destruct_callback) override { ApplicationThread* thread = @@ -110,7 +110,7 @@ class ContentHandlerImpl : public ContentHandler { ContentHandlerFactory::Delegate* delegate_; std::map<ApplicationThread*, base::PlatformThreadHandle> active_threads_; - StrongBinding<ContentHandler> binding_; + StrongBinding<shell::mojom::ContentHandler> binding_; base::WeakPtrFactory<ContentHandlerImpl> weak_factory_; DISALLOW_COPY_AND_ASSIGN(ContentHandlerImpl); @@ -126,7 +126,7 @@ ContentHandlerFactory::~ContentHandlerFactory() { } void ContentHandlerFactory::ManagedDelegate::RunApplication( - InterfaceRequest<Application> application_request, + InterfaceRequest<shell::mojom::Application> application_request, URLResponsePtr response) { base::MessageLoop loop(common::MessagePumpMojo::Create()); auto application = this->CreateApplication(std::move(application_request), @@ -135,8 +135,9 @@ void ContentHandlerFactory::ManagedDelegate::RunApplication( loop.Run(); } -void ContentHandlerFactory::Create(ApplicationConnection* connection, - InterfaceRequest<ContentHandler> request) { +void ContentHandlerFactory::Create( + ApplicationConnection* connection, + InterfaceRequest<shell::mojom::ContentHandler> request) { new ContentHandlerImpl(delegate_, std::move(request)); } diff --git a/mojo/shell/public/cpp/lib/service_registry.cc b/mojo/shell/public/cpp/lib/service_registry.cc index 6503e0b..1425276 100644 --- a/mojo/shell/public/cpp/lib/service_registry.cc +++ b/mojo/shell/public/cpp/lib/service_registry.cc @@ -47,7 +47,7 @@ ServiceRegistry::ServiceRegistry() ServiceRegistry::~ServiceRegistry() { } -Shell::ConnectToApplicationCallback +shell::mojom::Shell::ConnectToApplicationCallback ServiceRegistry::GetConnectToApplicationCallback() { return base::Bind(&ServiceRegistry::OnGotRemoteIDs, weak_factory_.GetWeakPtr()); diff --git a/mojo/shell/public/cpp/lib/service_registry.h b/mojo/shell/public/cpp/lib/service_registry.h index 09481e6..74c2e34 100644 --- a/mojo/shell/public/cpp/lib/service_registry.h +++ b/mojo/shell/public/cpp/lib/service_registry.h @@ -36,7 +36,8 @@ class ServiceRegistry : public ServiceProvider, public ApplicationConnection { const std::set<std::string>& allowed_interfaces); ~ServiceRegistry() override; - Shell::ConnectToApplicationCallback GetConnectToApplicationCallback(); + shell::mojom::Shell::ConnectToApplicationCallback + GetConnectToApplicationCallback(); // ApplicationConnection overrides. void SetServiceConnector(ServiceConnector* service_connector) override; diff --git a/mojo/shell/public/interfaces/application.mojom b/mojo/shell/public/interfaces/application.mojom index efe1e7b..b59b724 100644 --- a/mojo/shell/public/interfaces/application.mojom +++ b/mojo/shell/public/interfaces/application.mojom @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -module mojo; +module mojo.shell.mojom; import "mojo/shell/public/interfaces/service_provider.mojom"; import "mojo/shell/public/interfaces/shell.mojom"; @@ -63,8 +63,8 @@ interface Application { // AcceptConnection(string requestor_url, uint32 requestor_id, - ServiceProvider&? services, - ServiceProvider? exposed_services, + mojo.ServiceProvider&? services, + mojo.ServiceProvider? exposed_services, array<string> allowed_interfaces, string resolved_url); diff --git a/mojo/shell/public/interfaces/application_manager.mojom b/mojo/shell/public/interfaces/application_manager.mojom index d50f96e..c365146 100644 --- a/mojo/shell/public/interfaces/application_manager.mojom +++ b/mojo/shell/public/interfaces/application_manager.mojom @@ -54,7 +54,7 @@ interface ApplicationManager { // request there. CreateInstanceForHandle(handle channel, string url, - mojo.CapabilityFilter filter, + CapabilityFilter filter, PIDReceiver& pid_receiver); // The listener is removed when the pipe is closed. diff --git a/mojo/shell/public/interfaces/content_handler.mojom b/mojo/shell/public/interfaces/content_handler.mojom index 5fdb826..405238f 100644 --- a/mojo/shell/public/interfaces/content_handler.mojom +++ b/mojo/shell/public/interfaces/content_handler.mojom @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -module mojo; +module mojo.shell.mojom; import "mojo/shell/public/interfaces/application.mojom"; import "network/public/interfaces/url_loader.mojom"; @@ -16,5 +16,5 @@ import "network/public/interfaces/url_loader.mojom"; // implementation to self destruct and release the app reference. interface ContentHandler { // The callback should be called when the application is destructed. - StartApplication(Application& application, URLResponse response) => (); + StartApplication(Application& application, mojo.URLResponse response) => (); }; diff --git a/mojo/shell/public/interfaces/shell.mojom b/mojo/shell/public/interfaces/shell.mojom index 787ed11..1efc3586 100644 --- a/mojo/shell/public/interfaces/shell.mojom +++ b/mojo/shell/public/interfaces/shell.mojom @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -module mojo; +module mojo.shell.mojom; import "mojo/shell/public/interfaces/service_provider.mojom"; import "network/public/interfaces/url_loader.mojom"; @@ -61,9 +61,9 @@ interface Shell { // |content_handler_id| is the id of the deepest content handler used to // establish the connection to |application_url|. If no content handler is // used |content_handler_id| is kInvalidApplicationID. - ConnectToApplication(URLRequest application_url, - ServiceProvider&? services, - ServiceProvider? exposed_services, + ConnectToApplication(mojo.URLRequest application_url, + mojo.ServiceProvider&? services, + mojo.ServiceProvider? exposed_services, CapabilityFilter filter) => (uint32 application_id, uint32 content_handler_id); |