diff options
95 files changed, 408 insertions, 429 deletions
diff --git a/components/filesystem/main.cc b/components/filesystem/main.cc index b84980e..69be93f 100644 --- a/components/filesystem/main.cc +++ b/components/filesystem/main.cc @@ -7,7 +7,7 @@ #include "mojo/public/c/system/main.h" #include "mojo/shell/public/cpp/application_runner.h" -MojoResult MojoMain(MojoHandle application_request) { +MojoResult MojoMain(MojoHandle request) { mojo::ApplicationRunner runner(new filesystem::FileSystemApp()); - return runner.Run(application_request); + return runner.Run(request); } diff --git a/components/html_viewer/content_handler_impl.cc b/components/html_viewer/content_handler_impl.cc index 0b3b2ef..aff23ee 100644 --- a/components/html_viewer/content_handler_impl.cc +++ b/components/html_viewer/content_handler_impl.cc @@ -23,7 +23,7 @@ ContentHandlerImpl::~ContentHandlerImpl() { } void ContentHandlerImpl::StartApplication( - mojo::ApplicationRequest request, + mojo::ShellClientRequest request, mojo::URLResponsePtr response, const mojo::Callback<void()>& destruct_callback) { // HTMLDocumentApplicationDelegate deletes itself. diff --git a/components/html_viewer/content_handler_impl.h b/components/html_viewer/content_handler_impl.h index ee52c17..51fa01e 100644 --- a/components/html_viewer/content_handler_impl.h +++ b/components/html_viewer/content_handler_impl.h @@ -29,7 +29,7 @@ class ContentHandlerImpl : public mojo::shell::mojom::ContentHandler { private: // Overridden from shell::mojom::ContentHandler: void StartApplication( - mojo::ApplicationRequest request, + mojo::ShellClientRequest request, mojo::URLResponsePtr response, const mojo::Callback<void()>& destruct_callback) override; diff --git a/components/html_viewer/html_document.cc b/components/html_viewer/html_document.cc index fdb4efd..364b394 100644 --- a/components/html_viewer/html_document.cc +++ b/components/html_viewer/html_document.cc @@ -27,7 +27,7 @@ #include "components/mus/ws/ids.h" #include "mojo/converters/geometry/geometry_type_converters.h" #include "mojo/public/cpp/system/data_pipe.h" -#include "mojo/shell/public/cpp/application_impl.h" +#include "mojo/shell/public/cpp/shell_connection.h" #include "mojo/shell/public/interfaces/shell.mojom.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" #include "ui/gfx/geometry/dip_util.h" diff --git a/components/html_viewer/html_document.h b/components/html_viewer/html_document.h index 39dee11..efe7fb1 100644 --- a/components/html_viewer/html_document.h +++ b/components/html_viewer/html_document.h @@ -20,7 +20,7 @@ #include "mojo/services/network/public/interfaces/url_loader.mojom.h" #include "mojo/shell/public/cpp/app_lifetime_helper.h" #include "mojo/shell/public/cpp/interface_factory.h" -#include "mojo/shell/public/interfaces/application.mojom.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" namespace base { class SingleThreadTaskRunner; diff --git a/components/html_viewer/html_document_application_delegate.cc b/components/html_viewer/html_document_application_delegate.cc index e1208d2c..7316202 100644 --- a/components/html_viewer/html_document_application_delegate.cc +++ b/components/html_viewer/html_document_application_delegate.cc @@ -54,7 +54,7 @@ class HTMLDocumentApplicationDelegate::ServiceConnectorQueue }; HTMLDocumentApplicationDelegate::HTMLDocumentApplicationDelegate( - mojo::ApplicationRequest request, + mojo::ShellClientRequest request, mojo::URLResponsePtr response, GlobalState* global_state, scoped_ptr<mojo::AppRefCount> parent_app_refcount, diff --git a/components/html_viewer/html_document_application_delegate.h b/components/html_viewer/html_document_application_delegate.h index 8870021..da9b5b7 100644 --- a/components/html_viewer/html_document_application_delegate.h +++ b/components/html_viewer/html_document_application_delegate.h @@ -13,9 +13,9 @@ #include "components/html_viewer/html_factory.h" #include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h" -#include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/shell.h" #include "mojo/shell/public/cpp/shell_client.h" +#include "mojo/shell/public/cpp/shell_connection.h" namespace html_viewer { @@ -27,7 +27,7 @@ class HTMLDocumentApplicationDelegate : public mojo::ShellClient, public HTMLFactory { public: HTMLDocumentApplicationDelegate( - mojo::ApplicationRequest request, + mojo::ShellClientRequest request, mojo::URLResponsePtr response, GlobalState* global_state, scoped_ptr<mojo::AppRefCount> parent_app_refcount, @@ -64,7 +64,7 @@ class HTMLDocumentApplicationDelegate : public mojo::ShellClient, HTMLWidgetRootLocal* CreateHTMLWidgetRootLocal( HTMLWidgetRootLocal::CreateParams* params) override; - mojo::ApplicationImpl app_; + mojo::ShellConnection app_; // AppRefCount of the parent (HTMLViewer). scoped_ptr<mojo::AppRefCount> parent_app_refcount_; const mojo::String url_; diff --git a/components/html_viewer/layout_test_content_handler_impl.cc b/components/html_viewer/layout_test_content_handler_impl.cc index 7683e68..c541e29 100644 --- a/components/html_viewer/layout_test_content_handler_impl.cc +++ b/components/html_viewer/layout_test_content_handler_impl.cc @@ -62,7 +62,7 @@ LayoutTestContentHandlerImpl::~LayoutTestContentHandlerImpl() { } void LayoutTestContentHandlerImpl::StartApplication( - mojo::ApplicationRequest request, + mojo::ShellClientRequest request, mojo::URLResponsePtr response, const mojo::Callback<void()>& destruct_callback) { test_interfaces_->SetTestIsRunning(true); diff --git a/components/html_viewer/layout_test_content_handler_impl.h b/components/html_viewer/layout_test_content_handler_impl.h index 50f6b5c..5c39e25 100644 --- a/components/html_viewer/layout_test_content_handler_impl.h +++ b/components/html_viewer/layout_test_content_handler_impl.h @@ -39,7 +39,7 @@ class LayoutTestContentHandlerImpl : public ContentHandlerImpl, // ContentHandler: void StartApplication( - mojo::ApplicationRequest request, + mojo::ShellClientRequest request, mojo::URLResponsePtr response, const mojo::Callback<void()>& destruct_callback) override; diff --git a/components/mus/android_loader.cc b/components/mus/android_loader.cc index eeaddf4..0e9e5d8 100644 --- a/components/mus/android_loader.cc +++ b/components/mus/android_loader.cc @@ -5,7 +5,7 @@ #include "components/mus/android_loader.h" #include "components/mus/mus_app.h" -#include "mojo/shell/public/cpp/application_impl.h" +#include "mojo/shell/public/cpp/shell_connection.h" namespace mus { @@ -14,9 +14,9 @@ AndroidLoader::~AndroidLoader() {} void AndroidLoader::Load( const GURL& url, - mojo::InterfaceRequest<mojo::shell::mojom::Application> request) { + mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request) { DCHECK(request.is_pending()); - app_.reset(new mojo::ApplicationImpl(new MandolineUIServicesApp, + app_.reset(new mojo::ShellConnection(new MandolineUIServicesApp, std::move(request))); } diff --git a/components/mus/android_loader.h b/components/mus/android_loader.h index 7ff605d..88270f2 100644 --- a/components/mus/android_loader.h +++ b/components/mus/android_loader.h @@ -9,7 +9,7 @@ #include "mojo/shell/application_loader.h" namespace mojo { -class ApplicationImpl; +class ShellConnection; } namespace mus { @@ -23,9 +23,9 @@ class AndroidLoader : public mojo::shell::ApplicationLoader { // Overridden from mojo::shell::ApplicationLoader: void Load( const GURL& url, - mojo::InterfaceRequest<mojo::shell::mojom::Application> request) override; + mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request) override; - scoped_ptr<mojo::ApplicationImpl> app_; + scoped_ptr<mojo::ShellConnection> app_; DISALLOW_COPY_AND_ASSIGN(AndroidLoader); }; diff --git a/components/pdf_viewer/pdf_viewer.cc b/components/pdf_viewer/pdf_viewer.cc index 1fa2984..ba16212 100644 --- a/components/pdf_viewer/pdf_viewer.cc +++ b/components/pdf_viewer/pdf_viewer.cc @@ -27,10 +27,10 @@ #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/application_runner.h" #include "mojo/shell/public/cpp/interface_factory_impl.h" #include "mojo/shell/public/cpp/shell_client.h" +#include "mojo/shell/public/cpp/shell_connection.h" #include "mojo/shell/public/interfaces/content_handler.mojom.h" #include "mojo/shell/public/interfaces/shell.mojom.h" #include "third_party/pdfium/public/fpdf_ext.h" @@ -242,7 +242,7 @@ class PDFViewerApplicationDelegate public mojo::InterfaceFactory<mus::mojom::WindowTreeClient> { public: PDFViewerApplicationDelegate( - mojo::ApplicationRequest request, + mojo::ShellClientRequest request, mojo::URLResponsePtr response, const mojo::Callback<void()>& destruct_callback) : app_(this, @@ -305,7 +305,7 @@ class PDFViewerApplicationDelegate mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); } - mojo::ApplicationImpl app_; + mojo::ShellConnection app_; std::string data_; std::vector<PDFView*> pdf_views_; FPDF_DOCUMENT doc_; @@ -325,7 +325,7 @@ class ContentHandlerImpl : public mojo::shell::mojom::ContentHandler { private: // mojo::shell::mojom::ContentHandler: void StartApplication( - mojo::ApplicationRequest request, + mojo::ShellClientRequest request, mojo::URLResponsePtr response, const mojo::Callback<void()>& destruct_callback) override { new PDFViewerApplicationDelegate(std::move(request), std::move(response), @@ -374,7 +374,7 @@ class PDFViewer } // namespace } // namespace pdf_viewer -MojoResult MojoMain(MojoHandle application_request) { +MojoResult MojoMain(MojoHandle request) { mojo::ApplicationRunner runner(new pdf_viewer::PDFViewer()); - return runner.Run(application_request); + return runner.Run(request); } diff --git a/content/browser/mojo/mojo_shell_context.cc b/content/browser/mojo/mojo_shell_context.cc index f9a1f1c..4e5e70e 100644 --- a/content/browser/mojo/mojo_shell_context.cc +++ b/content/browser/mojo/mojo_shell_context.cc @@ -67,7 +67,7 @@ class DefaultApplicationLoader : public mojo::shell::ApplicationLoader { private: // mojo::shell::ApplicationLoader: void Load(const GURL& url, - mojo::InterfaceRequest<mojo::shell::mojom::Application> request) + mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request) override {} DISALLOW_COPY_AND_ASSIGN(DefaultApplicationLoader); @@ -85,7 +85,7 @@ class UtilityProcessLoader : public mojo::shell::ApplicationLoader { private: // mojo::shell::ApplicationLoader: void Load(const GURL& url, - mojo::InterfaceRequest<mojo::shell::mojom::Application> request) + mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request) override { ProcessControlPtr process_control; auto process_request = mojo::GetProxy(&process_control); @@ -130,7 +130,7 @@ class GpuProcessLoader : public mojo::shell::ApplicationLoader { private: // mojo::shell::ApplicationLoader: void Load(const GURL& url, - mojo::InterfaceRequest<mojo::shell::mojom::Application> request) + mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request) override { ProcessControlPtr process_control; auto process_request = mojo::GetProxy(&process_control); diff --git a/content/child/process_control_impl.cc b/content/child/process_control_impl.cc index f4cae6b..9f4b474 100644 --- a/content/child/process_control_impl.cc +++ b/content/child/process_control_impl.cc @@ -22,7 +22,7 @@ ProcessControlImpl::~ProcessControlImpl() { void ProcessControlImpl::LoadApplication( const mojo::String& url, - mojo::InterfaceRequest<mojo::shell::mojom::Application> request, + mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request, const LoadApplicationCallback& callback) { // Only register loaders when we need it. if (!has_registered_loaders_) { diff --git a/content/child/process_control_impl.h b/content/child/process_control_impl.h index 3b732f4..2fc8339 100644 --- a/content/child/process_control_impl.h +++ b/content/child/process_control_impl.h @@ -10,7 +10,7 @@ #include "base/macros.h" #include "content/common/process_control.mojom.h" #include "mojo/public/cpp/bindings/interface_request.h" -#include "mojo/shell/public/interfaces/application.mojom.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" class GURL; @@ -37,7 +37,7 @@ class ProcessControlImpl : public ProcessControl { // ProcessControl: void LoadApplication( const mojo::String& url, - mojo::InterfaceRequest<mojo::shell::mojom::Application> request, + mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request, const LoadApplicationCallback& callback) override; private: diff --git a/content/common/mojo/mojo_shell_connection_impl.cc b/content/common/mojo/mojo_shell_connection_impl.cc index 36004514..79256c8 100644 --- a/content/common/mojo/mojo_shell_connection_impl.cc +++ b/content/common/mojo/mojo_shell_connection_impl.cc @@ -11,8 +11,8 @@ #include "base/stl_util.h" #include "base/threading/thread_local.h" #include "mojo/converters/network/network_type_converters.h" -#include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/shell_client.h" +#include "mojo/shell/public/cpp/shell_connection.h" #include "mojo/shell/runner/child/runner_connection.h" namespace content { @@ -64,12 +64,11 @@ MojoShellConnectionImpl::~MojoShellConnectionImpl() { void MojoShellConnectionImpl::WaitForShell( mojo::ScopedMessagePipeHandle handle) { - mojo::ApplicationRequest application_request; + mojo::ShellClientRequest request; runner_connection_.reset(mojo::shell::RunnerConnection::ConnectToRunner( - &application_request, std::move(handle))); - application_impl_.reset( - new mojo::ApplicationImpl(this, std::move(application_request))); - application_impl_->WaitForInitialize(); + &request, std::move(handle))); + shell_connection_.reset(new mojo::ShellConnection(this, std::move(request))); + shell_connection_->WaitForInitialize(); } void MojoShellConnectionImpl::Initialize(mojo::Shell* shell, @@ -87,7 +86,7 @@ bool MojoShellConnectionImpl::AcceptConnection(mojo::Connection* connection) { mojo::Shell* MojoShellConnectionImpl::GetShell() { DCHECK(initialized_); - return application_impl_.get(); + return shell_connection_.get(); } void MojoShellConnectionImpl::AddListener(Listener* listener) { diff --git a/content/common/mojo/mojo_shell_connection_impl.h b/content/common/mojo/mojo_shell_connection_impl.h index d85fe0e..dfd9490 100644 --- a/content/common/mojo/mojo_shell_connection_impl.h +++ b/content/common/mojo/mojo_shell_connection_impl.h @@ -11,8 +11,8 @@ #include "base/memory/scoped_ptr.h" #include "content/public/common/mojo_shell_connection.h" #include "mojo/public/cpp/system/message_pipe.h" -#include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/shell_client.h" +#include "mojo/shell/public/cpp/shell_connection.h" namespace mojo { namespace shell { @@ -67,7 +67,7 @@ class MojoShellConnectionImpl : public MojoShellConnection, bool initialized_; scoped_ptr<mojo::shell::RunnerConnection> runner_connection_; - scoped_ptr<mojo::ApplicationImpl> application_impl_; + scoped_ptr<mojo::ShellConnection> shell_connection_; std::vector<Listener*> listeners_; DISALLOW_COPY_AND_ASSIGN(MojoShellConnectionImpl); diff --git a/content/common/process_control.mojom b/content/common/process_control.mojom index c9ed0dd..8e70a94 100644 --- a/content/common/process_control.mojom +++ b/content/common/process_control.mojom @@ -4,10 +4,10 @@ module content; -import "mojo/shell/public/interfaces/application.mojom"; +import "mojo/shell/public/interfaces/shell_client.mojom"; interface ProcessControl { LoadApplication(string url, - mojo.shell.mojom.Application& request) => (bool success); + mojo.shell.mojom.ShellClient& request) => (bool success); }; diff --git a/content/public/common/mojo_shell_connection.h b/content/public/common/mojo_shell_connection.h index 4f8d759..da9bb17 100644 --- a/content/public/common/mojo_shell_connection.h +++ b/content/public/common/mojo_shell_connection.h @@ -45,7 +45,7 @@ class CONTENT_EXPORT MojoShellConnection { virtual mojo::Shell* GetShell() = 0; // [De]Register an impl of Listener that will be consulted when the wrapped - // ApplicationImpl exposes services to inbound connections. + // ShellConnection exposes services to inbound connections. // Registered listeners are owned by this MojoShellConnection. virtual void AddListener(Listener* listener) = 0; virtual void RemoveListener(Listener* listener) = 0; diff --git a/mandoline/services/core_services/core_services_application_delegate.cc b/mandoline/services/core_services/core_services_application_delegate.cc index f20b7df..4d7856e 100644 --- a/mandoline/services/core_services/core_services_application_delegate.cc +++ b/mandoline/services/core_services/core_services_application_delegate.cc @@ -25,7 +25,7 @@ namespace core_services { -// A helper class for hosting a mojo::ApplicationImpl on its own thread. +// A helper class for hosting a mojo::ShellConnection on its own thread. class ApplicationThread : public base::SimpleThread { public: ApplicationThread( @@ -33,7 +33,7 @@ class ApplicationThread : public base::SimpleThread { core_services_application, const std::string& url, scoped_ptr<mojo::ShellClient> delegate, - mojo::InterfaceRequest<mojo::shell::mojom::Application> request, + mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request, const mojo::Callback<void()>& destruct_callback) : base::SimpleThread(url), core_services_application_(core_services_application), @@ -73,7 +73,7 @@ class ApplicationThread : public base::SimpleThread { core_services_application_task_runner_; std::string url_; scoped_ptr<mojo::ShellClient> delegate_; - mojo::InterfaceRequest<mojo::shell::mojom::Application> request_; + mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request_; mojo::Callback<void()> destruct_callback_; DISALLOW_COPY_AND_ASSIGN(ApplicationThread); @@ -124,7 +124,7 @@ void CoreServicesApplicationDelegate::Create( } void CoreServicesApplicationDelegate::StartApplication( - mojo::InterfaceRequest<mojo::shell::mojom::Application> request, + mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request, mojo::URLResponsePtr response, const mojo::Callback<void()>& destruct_callback) { const std::string url = response->url; diff --git a/mandoline/services/core_services/core_services_application_delegate.h b/mandoline/services/core_services/core_services_application_delegate.h index 55f5387..bb2cff1 100644 --- a/mandoline/services/core_services/core_services_application_delegate.h +++ b/mandoline/services/core_services/core_services_application_delegate.h @@ -46,7 +46,7 @@ class CoreServicesApplicationDelegate // Overridden from mojo::shell::mojom::ContentHandler: void StartApplication( - mojo::InterfaceRequest<mojo::shell::mojom::Application> request, + mojo::InterfaceRequest<mojo::shell::mojom::ShellClient> request, mojo::URLResponsePtr response, const mojo::Callback<void()>& destruct_callback) override; diff --git a/mandoline/services/updater/updater_impl.cc b/mandoline/services/updater/updater_impl.cc index 478722b..573bf7d 100644 --- a/mandoline/services/updater/updater_impl.cc +++ b/mandoline/services/updater/updater_impl.cc @@ -9,7 +9,7 @@ #include "base/files/file_util.h" #include "base/path_service.h" #include "mandoline/services/updater/updater_app.h" -#include "mojo/shell/public/cpp/application_impl.h" +#include "mojo/shell/public/cpp/shell_connection.h" #include "url/gurl.h" namespace updater { diff --git a/mandoline/services/updater/updater_impl.h b/mandoline/services/updater/updater_impl.h index b7154cd..4a7a257 100644 --- a/mandoline/services/updater/updater_impl.h +++ b/mandoline/services/updater/updater_impl.h @@ -8,7 +8,7 @@ #include "base/macros.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/services/updater/updater.mojom.h" -#include "mojo/shell/public/cpp/application_impl.h" +#include "mojo/shell/public/cpp/shell_connection.h" namespace updater { diff --git a/mash/example/common/mus_views_init.h b/mash/example/common/mus_views_init.h index 43da4f4..aff5dc7 100644 --- a/mash/example/common/mus_views_init.h +++ b/mash/example/common/mus_views_init.h @@ -13,7 +13,7 @@ #include "ui/views/views_delegate.h" namespace mojo { -class ApplicationImpl; +class ShellConnection; } namespace views { @@ -24,7 +24,7 @@ class AuraInit; class MUSViewsInit : public views::ViewsDelegate, public mus::WindowTreeDelegate { public: - explicit MUSViewsInit(mojo::ApplicationImpl* app); + explicit MUSViewsInit(mojo::ShellConnection* app); ~MUSViewsInit() override; private: @@ -44,7 +44,7 @@ class MUSViewsInit : public views::ViewsDelegate, HICON GetSmallWindowIcon() const override; #endif - mojo::ApplicationImpl* app_; + mojo::ShellConnection* app_; scoped_ptr<views::AuraInit> aura_init_; mus::mojom::WindowManagerPtr window_manager_; diff --git a/mash/example/window_type_launcher/main.cc b/mash/example/window_type_launcher/main.cc index 53d6257..289b56c 100644 --- a/mash/example/window_type_launcher/main.cc +++ b/mash/example/window_type_launcher/main.cc @@ -15,8 +15,8 @@ #include "build/build_config.h" #include "mash/example/window_type_launcher/window_type_launcher.h" #include "mojo/message_pump/message_pump_mojo.h" -#include "mojo/shell/public/cpp/application_impl.h" -#include "mojo/shell/public/interfaces/application.mojom.h" +#include "mojo/shell/public/cpp/shell_connection.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" #include "mojo/shell/runner/child/runner_connection.h" #include "mojo/shell/runner/init.h" #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" @@ -65,13 +65,13 @@ int main(int argc, char** argv) { io_thread.task_runner().get(), mojo::embedder::ScopedPlatformHandle()); - mojo::ApplicationRequest application_request; + mojo::ShellClientRequest request; scoped_ptr<mojo::shell::RunnerConnection> connection( mojo::shell::RunnerConnection::ConnectToRunner( - &application_request, mojo::ScopedMessagePipeHandle())); + &request, mojo::ScopedMessagePipeHandle())); base::MessageLoop loop(mojo::common::MessagePumpMojo::Create()); WindowTypeLauncher delegate; - mojo::ApplicationImpl impl(&delegate, std::move(application_request)); + mojo::ShellConnection impl(&delegate, std::move(request)); loop.Run(); mojo::embedder::ShutdownIPCSupport(); diff --git a/mojo/mojo_base.gyp b/mojo/mojo_base.gyp index 928ae30..86a028f 100644 --- a/mojo/mojo_base.gyp +++ b/mojo/mojo_base.gyp @@ -204,11 +204,11 @@ 'type': 'none', 'variables': { 'mojom_files': [ - 'shell/public/interfaces/application.mojom', 'shell/public/interfaces/application_manager.mojom', 'shell/public/interfaces/content_handler.mojom', 'shell/public/interfaces/service_provider.mojom', 'shell/public/interfaces/shell.mojom', + 'shell/public/interfaces/shell_client.mojom', ], }, 'dependencies': [ @@ -225,7 +225,6 @@ 'type': 'static_library', 'sources': [ 'shell/public/cpp/app_lifetime_helper.h', - 'shell/public/cpp/application_impl.h', 'shell/public/cpp/application_runner.h', 'shell/public/cpp/connect.h', 'shell/public/cpp/connection.h', @@ -234,15 +233,16 @@ 'shell/public/cpp/interface_factory.h', 'shell/public/cpp/interface_factory_impl.h', 'shell/public/cpp/lib/app_lifetime_helper.cc', - 'shell/public/cpp/lib/application_impl.cc', 'shell/public/cpp/lib/application_runner.cc', 'shell/public/cpp/lib/connection_impl.cc', 'shell/public/cpp/lib/connection_impl.h', 'shell/public/cpp/lib/interface_factory_connector.h', 'shell/public/cpp/lib/shell_client.cc', + 'shell/public/cpp/lib/shell_connection.cc', 'shell/public/cpp/service_connector.h', 'shell/public/cpp/shell.h', 'shell/public/cpp/shell_client.h', + 'shell/public/cpp/shell_connection.h', ], 'dependencies': [ '../base/base.gyp:base_i18n', diff --git a/mojo/public/cpp/bindings/tests/versioning_test_service.cc b/mojo/public/cpp/bindings/tests/versioning_test_service.cc index 007a82a..dab1b77 100644 --- a/mojo/public/cpp/bindings/tests/versioning_test_service.cc +++ b/mojo/public/cpp/bindings/tests/versioning_test_service.cc @@ -118,9 +118,9 @@ class HumanResourceSystemServer } // namespace test } // namespace mojo -MojoResult MojoMain(MojoHandle application_request) { +MojoResult MojoMain(MojoHandle request) { mojo::ApplicationRunner runner( new mojo::test::versioning::HumanResourceSystemServer()); - return runner.Run(application_request); + return runner.Run(request); } diff --git a/mojo/services/test_service/test_request_tracker_application.h b/mojo/services/test_service/test_request_tracker_application.h index 74aa39c..8ace9ec 100644 --- a/mojo/services/test_service/test_request_tracker_application.h +++ b/mojo/services/test_service/test_request_tracker_application.h @@ -11,7 +11,7 @@ #include "mojo/shell/public/cpp/shell_client.h" namespace mojo { -class ApplicationImpl; +class ShellConnection; namespace test { class TestTimeService; diff --git a/mojo/shell/application_instance.cc b/mojo/shell/application_instance.cc index 7d9abdf..d09e142 100644 --- a/mojo/shell/application_instance.cc +++ b/mojo/shell/application_instance.cc @@ -20,7 +20,7 @@ namespace mojo { namespace shell { ApplicationInstance::ApplicationInstance( - mojom::ApplicationPtr application, + mojom::ShellClientPtr shell_client, ApplicationManager* manager, const Identity& identity, uint32_t requesting_content_handler_id, @@ -32,7 +32,7 @@ ApplicationInstance::ApplicationInstance( identity.filter().count("*") == 1), requesting_content_handler_id_(requesting_content_handler_id), on_application_end_(on_application_end), - application_(std::move(application)), + shell_client_(std::move(shell_client)), binding_(this), pid_receiver_binding_(this), queue_requests_(false), @@ -50,8 +50,8 @@ ApplicationInstance::~ApplicationInstance() { } void ApplicationInstance::InitializeApplication() { - application_->Initialize(binding_.CreateInterfacePtrAndBind(), - identity_.url().spec(), id_); + shell_client_->Initialize(binding_.CreateInterfacePtrAndBind(), + identity_.url().spec(), id_); binding_.set_connection_error_handler([this]() { OnConnectionError(); }); } @@ -114,7 +114,7 @@ void ApplicationInstance::ConnectToApplication( void ApplicationInstance::QuitApplication() { queue_requests_ = true; - application_->OnQuitRequested( + shell_client_->OnQuitRequested( base::Bind(&ApplicationInstance::OnQuitRequestedResult, base::Unretained(this))); } @@ -142,7 +142,7 @@ void ApplicationInstance::CallAcceptConnection( ApplicationInstance* source = manager_->GetApplicationInstance(params->source()); uint32_t source_id = source ? source->id() : Shell::kInvalidApplicationID; - application_->AcceptConnection( + shell_client_->AcceptConnection( params->source().url().spec(), source_id, params->TakeServices(), params->TakeExposedServices(), Array<String>::From(interfaces), params->target().url().spec()); diff --git a/mojo/shell/application_instance.h b/mojo/shell/application_instance.h index cae1442..fded574 100644 --- a/mojo/shell/application_instance.h +++ b/mojo/shell/application_instance.h @@ -17,9 +17,9 @@ #include "mojo/shell/capability_filter.h" #include "mojo/shell/connect_to_application_params.h" #include "mojo/shell/identity.h" -#include "mojo/shell/public/interfaces/application.mojom.h" #include "mojo/shell/public/interfaces/application_manager.mojom.h" #include "mojo/shell/public/interfaces/shell.mojom.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" #include "url/gurl.h" namespace mojo { @@ -36,7 +36,7 @@ class ApplicationInstance : public mojom::Shell, // |requesting_content_handler_id| is the id of the content handler that // loaded this app. If the app was not loaded by a content handler the id // is kInvalidContentHandlerID. - ApplicationInstance(mojom::ApplicationPtr application, + ApplicationInstance(mojom::ShellClientPtr shell_client, ApplicationManager* manager, const Identity& identity, uint32_t requesting_content_handler_id, @@ -53,7 +53,7 @@ class ApplicationInstance : public mojom::Shell, void BindPIDReceiver(InterfaceRequest<mojom::PIDReceiver> pid_receiver); - mojom::Application* application() { return application_.get(); } + mojom::ShellClient* shell_client() { return shell_client_.get(); } const Identity& identity() const { return identity_; } uint32_t id() const { return id_; } base::ProcessId pid() const { return pid_; } @@ -98,7 +98,7 @@ class ApplicationInstance : public mojom::Shell, const bool allow_any_application_; uint32_t requesting_content_handler_id_; base::Closure on_application_end_; - mojom::ApplicationPtr application_; + mojom::ShellClientPtr shell_client_; Binding<mojom::Shell> binding_; Binding<mojom::PIDReceiver> pid_receiver_binding_; bool queue_requests_; diff --git a/mojo/shell/application_loader.h b/mojo/shell/application_loader.h index 21e7911..3b22dc2 100644 --- a/mojo/shell/application_loader.h +++ b/mojo/shell/application_loader.h @@ -8,8 +8,8 @@ #include "base/callback.h" #include "mojo/public/cpp/system/core.h" #include "mojo/services/network/public/interfaces/url_loader.mojom.h" -#include "mojo/shell/public/interfaces/application.mojom.h" #include "mojo/shell/public/interfaces/shell.mojom.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" #include "url/gurl.h" namespace mojo { @@ -26,9 +26,8 @@ class ApplicationLoader { public: virtual ~ApplicationLoader() {} - virtual void Load( - const GURL& url, - InterfaceRequest<mojom::Application> application_request) = 0; + virtual void Load(const GURL& url, + InterfaceRequest<mojom::ShellClient> request) = 0; protected: ApplicationLoader() {} diff --git a/mojo/shell/application_manager.cc b/mojo/shell/application_manager.cc index 2e6a1f2..b8dda51 100644 --- a/mojo/shell/application_manager.cc +++ b/mojo/shell/application_manager.cc @@ -140,12 +140,12 @@ void ApplicationManager::CreateInstanceForHandle( CapabilityFilter local_filter = filter->filter.To<CapabilityFilter>(); Identity target_id(url, std::string(), local_filter); ApplicationInstance* instance = nullptr; - InterfaceRequest<mojom::Application> application_request = + InterfaceRequest<mojom::ShellClient> request = CreateInstance(target_id, base::Closure(), &instance); instance->BindPIDReceiver(std::move(pid_receiver)); scoped_ptr<NativeRunner> runner = native_runner_factory_->Create(base::FilePath()); - runner->InitHost(std::move(channel), std::move(application_request)); + runner->InitHost(std::move(channel), std::move(request)); instance->SetNativeRunner(runner.get()); native_runners_.push_back(std::move(runner)); } @@ -175,28 +175,27 @@ void ApplicationManager::ApplicationPIDAvailable( }); } -InterfaceRequest<mojom::Application> +InterfaceRequest<mojom::ShellClient> ApplicationManager::CreateAndConnectToInstance( scoped_ptr<ConnectToApplicationParams> params, ApplicationInstance** resulting_instance) { ApplicationInstance* instance = nullptr; - InterfaceRequest<mojom::Application> application_request = + InterfaceRequest<mojom::ShellClient> request = CreateInstance(params->target(), params->on_application_end(), &instance); instance->ConnectToClient(std::move(params)); if (resulting_instance) *resulting_instance = instance; - return application_request; + return request; } -InterfaceRequest<mojom::Application> ApplicationManager::CreateInstance( +InterfaceRequest<mojom::ShellClient> ApplicationManager::CreateInstance( const Identity& target_id, const base::Closure& on_application_end, ApplicationInstance** resulting_instance) { - mojom::ApplicationPtr application; - InterfaceRequest<mojom::Application> application_request = - GetProxy(&application); + mojom::ShellClientPtr shell_client; + InterfaceRequest<mojom::ShellClient> request = GetProxy(&shell_client); ApplicationInstance* instance = new ApplicationInstance( - std::move(application), this, target_id, + std::move(shell_client), this, target_id, mojom::Shell::kInvalidApplicationID, on_application_end); DCHECK(identity_to_instance_.find(target_id) == identity_to_instance_.end()); @@ -210,7 +209,7 @@ InterfaceRequest<mojom::Application> ApplicationManager::CreateInstance( instance->InitializeApplication(); if (resulting_instance) *resulting_instance = instance; - return application_request; + return request; } void ApplicationManager::HandleFetchCallback( @@ -250,7 +249,7 @@ void ApplicationManager::HandleFetchCallback( params->connect_callback(); params->set_connect_callback(EmptyConnectCallback()); ApplicationInstance* app = nullptr; - InterfaceRequest<mojom::Application> request( + InterfaceRequest<mojom::ShellClient> request( CreateAndConnectToInstance(std::move(params), &app)); uint32_t content_handler_id = package_manager_->HandleWithContentHandler( @@ -282,7 +281,7 @@ void ApplicationManager::HandleFetchCallback( } void ApplicationManager::RunNativeApplication( - InterfaceRequest<mojom::Application> application_request, + InterfaceRequest<mojom::ShellClient> request, bool start_sandboxed, scoped_ptr<Fetcher> fetcher, ApplicationInstance* instance, @@ -291,7 +290,7 @@ void ApplicationManager::RunNativeApplication( // We only passed fetcher to keep it alive. Done with it now. fetcher.reset(); - DCHECK(application_request.is_pending()); + DCHECK(request.is_pending()); if (!path_exists) { LOG(ERROR) << "Library not started because library path '" << path.value() @@ -302,7 +301,7 @@ void ApplicationManager::RunNativeApplication( TRACE_EVENT1("mojo_shell", "ApplicationManager::RunNativeApplication", "path", path.AsUTF8Unsafe()); scoped_ptr<NativeRunner> runner = native_runner_factory_->Create(path); - runner->Start(path, start_sandboxed, std::move(application_request), + runner->Start(path, start_sandboxed, std::move(request), base::Bind(&ApplicationManager::ApplicationPIDAvailable, weak_ptr_factory_.GetWeakPtr(), instance->id()), base::Bind(&ApplicationManager::CleanupRunner, diff --git a/mojo/shell/application_manager.h b/mojo/shell/application_manager.h index f20a9ae..81e1e9f 100644 --- a/mojo/shell/application_manager.h +++ b/mojo/shell/application_manager.h @@ -21,10 +21,10 @@ #include "mojo/shell/fetcher.h" #include "mojo/shell/identity.h" #include "mojo/shell/native_runner.h" -#include "mojo/shell/public/interfaces/application.mojom.h" #include "mojo/shell/public/interfaces/application_manager.mojom.h" #include "mojo/shell/public/interfaces/service_provider.mojom.h" #include "mojo/shell/public/interfaces/shell.mojom.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" #include "url/gurl.h" namespace base { @@ -114,10 +114,10 @@ class ApplicationManager { bool ConnectToRunningApplication( scoped_ptr<ConnectToApplicationParams>* params); - InterfaceRequest<mojom::Application> CreateAndConnectToInstance( + InterfaceRequest<mojom::ShellClient> CreateAndConnectToInstance( scoped_ptr<ConnectToApplicationParams> params, ApplicationInstance** instance); - InterfaceRequest<mojom::Application> CreateInstance( + InterfaceRequest<mojom::ShellClient> CreateInstance( const Identity& target_id, const base::Closure& on_application_end, ApplicationInstance** resulting_instance); @@ -128,13 +128,12 @@ class ApplicationManager { void HandleFetchCallback(scoped_ptr<ConnectToApplicationParams> params, scoped_ptr<Fetcher> fetcher); - void RunNativeApplication( - InterfaceRequest<mojom::Application> application_request, - bool start_sandboxed, - scoped_ptr<Fetcher> fetcher, - ApplicationInstance* instance, - const base::FilePath& file_path, - bool path_exists); + void RunNativeApplication(InterfaceRequest<mojom::ShellClient> request, + bool start_sandboxed, + scoped_ptr<Fetcher> fetcher, + ApplicationInstance* instance, + const base::FilePath& file_path, + bool path_exists); // Returns the appropriate loader for |url|, or the default loader if there is // no loader configured for the URL. diff --git a/mojo/shell/application_manager_unittest.cc b/mojo/shell/application_manager_unittest.cc index b83f320..36aa993 100644 --- a/mojo/shell/application_manager_unittest.cc +++ b/mojo/shell/application_manager_unittest.cc @@ -17,9 +17,9 @@ #include "mojo/shell/connect_util.h" #include "mojo/shell/fetcher.h" #include "mojo/shell/package_manager.h" -#include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/interface_factory.h" #include "mojo/shell/public/cpp/shell_client.h" +#include "mojo/shell/public/cpp/shell_connection.h" #include "mojo/shell/public/interfaces/service_provider.mojom.h" #include "mojo/shell/test.mojom.h" #include "mojo/shell/test_package_manager.h" @@ -103,7 +103,7 @@ class TestApplicationLoader : public ApplicationLoader, ~TestApplicationLoader() override { if (context_) ++context_->num_loader_deletes; - test_app_.reset(); + shell_connection_.reset(); } void set_context(TestContext* context) { context_ = context; } @@ -113,9 +113,9 @@ class TestApplicationLoader : public ApplicationLoader, private: // ApplicationLoader implementation. void Load(const GURL& url, - InterfaceRequest<mojom::Application> application_request) override { + InterfaceRequest<mojom::ShellClient> request) override { ++num_loads_; - test_app_.reset(new ApplicationImpl(this, std::move(application_request))); + shell_connection_.reset(new ShellConnection(this, std::move(request))); } // mojo::ShellClient implementation. @@ -131,7 +131,7 @@ class TestApplicationLoader : public ApplicationLoader, new TestServiceImpl(context_, std::move(request)); } - scoped_ptr<ApplicationImpl> test_app_; + scoped_ptr<ShellConnection> shell_connection_; TestContext* context_; int num_loads_; GURL last_requestor_url_; @@ -143,7 +143,7 @@ class ClosingApplicationLoader : public ApplicationLoader { private: // ApplicationLoader implementation. void Load(const GURL& url, - InterfaceRequest<mojom::Application> application_request) override { + InterfaceRequest<mojom::ShellClient> request) override { } }; @@ -245,7 +245,7 @@ class TesterContext { // Used to test that the requestor url will be correctly passed. class TestAImpl : public TestA { public: - TestAImpl(ApplicationImpl* app_impl, + TestAImpl(ShellConnection* app_impl, TesterContext* test_context, InterfaceRequest<TestA> request, InterfaceFactory<TestC>* factory) @@ -345,8 +345,8 @@ class Tester : public ShellClient, private: void Load(const GURL& url, - InterfaceRequest<mojom::Application> application_request) override { - app_.reset(new ApplicationImpl(this, std::move(application_request))); + InterfaceRequest<mojom::ShellClient> request) override { + app_.reset(new ShellConnection(this, std::move(request))); } bool AcceptConnection(Connection* connection) override { @@ -382,7 +382,7 @@ class Tester : public ShellClient, } TesterContext* context_; - scoped_ptr<ApplicationImpl> app_; + scoped_ptr<ShellConnection> app_; std::string requestor_url_; ScopedVector<TestAImpl> a_bindings_; }; diff --git a/mojo/shell/application_package_apptest.cc b/mojo/shell/application_package_apptest.cc index 3d19daf..7ccf0ba 100644 --- a/mojo/shell/application_package_apptest.cc +++ b/mojo/shell/application_package_apptest.cc @@ -36,7 +36,7 @@ class ProvidedApplicationDelegate public base::SimpleThread { public: ProvidedApplicationDelegate(const std::string& name, - InterfaceRequest<mojom::Application> request, + InterfaceRequest<mojom::ShellClient> request, const Callback<void()>& destruct_callback) : base::SimpleThread(name), name_(name), @@ -78,7 +78,7 @@ class ProvidedApplicationDelegate } const std::string name_; - InterfaceRequest<mojom::Application> request_; + InterfaceRequest<mojom::ShellClient> request_; const Callback<void()> destruct_callback_; WeakBindingSet<test::mojom::ApplicationPackageApptestService> bindings_; @@ -118,7 +118,7 @@ class ApplicationPackageApptestDelegate } // mojom::ContentHandler: - void StartApplication(InterfaceRequest<mojom::Application> request, + void StartApplication(InterfaceRequest<mojom::ShellClient> request, URLResponsePtr response, const Callback<void()>& destruct_callback) override { const std::string url = response->url; diff --git a/mojo/shell/background/background_shell.cc b/mojo/shell/background/background_shell.cc index 0de797c..17522f0 100644 --- a/mojo/shell/background/background_shell.cc +++ b/mojo/shell/background/background_shell.cc @@ -16,8 +16,8 @@ #include "mojo/shell/application_manager.h" #include "mojo/shell/capability_filter.h" #include "mojo/shell/connect_to_application_params.h" -#include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/shell_client.h" +#include "mojo/shell/public/cpp/shell_connection.h" #include "mojo/shell/standalone/context.h" #include "url/gurl.h" @@ -36,20 +36,20 @@ class BackgroundApplicationLoader : public ApplicationLoader { ~BackgroundApplicationLoader() override {} bool got_request() const { return got_request_; } - InterfaceRequest<mojom::Application> TakeApplicationRequest() { - return std::move(application_request_); + InterfaceRequest<mojom::ShellClient> TakeApplicationRequest() { + return std::move(request_); } // ApplicationLoader: void Load(const GURL& url, - InterfaceRequest<mojom::Application> application_request) override { + InterfaceRequest<mojom::ShellClient> request) override { got_request_ = true; - application_request_ = std::move(application_request); + request_ = std::move(request); } private: bool got_request_ = false; - InterfaceRequest<mojom::Application> application_request_; + InterfaceRequest<mojom::ShellClient> request_; DISALLOW_COPY_AND_ASSIGN(BackgroundApplicationLoader); }; @@ -75,9 +75,9 @@ class BackgroundShell::MojoThread : public base::SimpleThread { MojoThread() : SimpleThread("mojo-background-shell") {} ~MojoThread() override {} - void CreateApplicationImpl(base::WaitableEvent* signal, - scoped_ptr<ConnectToApplicationParams> params, - InterfaceRequest<mojom::Application>* request) { + void CreateShellClientRequest(base::WaitableEvent* signal, + scoped_ptr<ConnectToApplicationParams> params, + InterfaceRequest<mojom::ShellClient>* request) { // Only valid to call this on the background thread. DCHECK_EQ(message_loop_, base::MessageLoop::current()); @@ -158,15 +158,15 @@ void BackgroundShell::Init() { thread_->Start(); } -InterfaceRequest<mojom::Application> BackgroundShell::CreateApplication( +InterfaceRequest<mojom::ShellClient> BackgroundShell::CreateShellClientRequest( const GURL& url) { scoped_ptr<ConnectToApplicationParams> params(new ConnectToApplicationParams); params->SetTarget( Identity(url, std::string(), GetPermissiveCapabilityFilter())); - InterfaceRequest<mojom::Application> request; + InterfaceRequest<mojom::ShellClient> request; base::WaitableEvent signal(true, false); thread_->message_loop()->task_runner()->PostTask( - FROM_HERE, base::Bind(&MojoThread::CreateApplicationImpl, + FROM_HERE, base::Bind(&MojoThread::CreateShellClientRequest, base::Unretained(thread_.get()), &signal, base::Passed(¶ms), &request)); signal.Wait(); diff --git a/mojo/shell/background/background_shell.h b/mojo/shell/background/background_shell.h index ce68649..e2163f4 100644 --- a/mojo/shell/background/background_shell.h +++ b/mojo/shell/background/background_shell.h @@ -8,7 +8,7 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "mojo/public/cpp/bindings/interface_request.h" -#include "mojo/shell/public/interfaces/application.mojom.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" class GURL; @@ -27,7 +27,8 @@ class BackgroundShell { void Init(); // Obtains an InterfaceRequest for the specified url. - InterfaceRequest<mojom::Application> CreateApplication(const GURL& url); + InterfaceRequest<mojom::ShellClient> CreateShellClientRequest( + const GURL& url); private: class MojoThread; diff --git a/mojo/shell/capability_filter_test.cc b/mojo/shell/capability_filter_test.cc index f7edd90..c626a48 100644 --- a/mojo/shell/capability_filter_test.cc +++ b/mojo/shell/capability_filter_test.cc @@ -13,9 +13,9 @@ #include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/shell/application_loader.h" #include "mojo/shell/package_manager.h" -#include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_connection.h" namespace mojo { namespace shell { @@ -50,8 +50,8 @@ class ConnectionValidator : public ApplicationLoader, private: // Overridden from ApplicationLoader: void Load(const GURL& url, - InterfaceRequest<mojom::Application> request) override { - app_.reset(new ApplicationImpl(this, std::move(request))); + InterfaceRequest<mojom::ShellClient> request) override { + app_.reset(new ShellConnection(this, std::move(request))); } // Overridden from ShellClient: @@ -94,7 +94,7 @@ class ConnectionValidator : public ApplicationLoader, } } - scoped_ptr<ApplicationImpl> app_; + scoped_ptr<ShellConnection> app_; std::set<std::string> expectations_; std::set<std::string> unexpected_; base::MessageLoop* loop_; @@ -194,8 +194,8 @@ TestLoader::TestLoader(ShellClient* delegate) : delegate_(delegate) {} TestLoader::~TestLoader() {} void TestLoader::Load(const GURL& url, - InterfaceRequest<mojom::Application> request) { - app_.reset(new ApplicationImpl(delegate_.get(), std::move(request))); + InterfaceRequest<mojom::ShellClient> request) { + app_.reset(new ShellConnection(delegate_.get(), std::move(request))); } //////////////////////////////////////////////////////////////////////////////// diff --git a/mojo/shell/capability_filter_test.h b/mojo/shell/capability_filter_test.h index 9052d18..e235802 100644 --- a/mojo/shell/capability_filter_test.h +++ b/mojo/shell/capability_filter_test.h @@ -9,8 +9,8 @@ #include "mojo/shell/application_loader.h" #include "mojo/shell/application_manager.h" #include "mojo/shell/capability_filter_unittest.mojom.h" -#include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/shell_client.h" +#include "mojo/shell/public/cpp/shell_connection.h" #include "testing/gtest/include/gtest/gtest.h" namespace mojo { @@ -51,10 +51,10 @@ class TestLoader : public ApplicationLoader { private: // Overridden from ApplicationLoader: void Load(const GURL& url, - InterfaceRequest<mojom::Application> request) override; + InterfaceRequest<mojom::ShellClient> request) override; scoped_ptr<ShellClient> delegate_; - scoped_ptr<ApplicationImpl> app_; + scoped_ptr<ShellConnection> app_; DISALLOW_COPY_AND_ASSIGN(TestLoader); }; diff --git a/mojo/shell/fetcher/about_fetcher_unittest.cc b/mojo/shell/fetcher/about_fetcher_unittest.cc index b9e6046..ba7714a 100644 --- a/mojo/shell/fetcher/about_fetcher_unittest.cc +++ b/mojo/shell/fetcher/about_fetcher_unittest.cc @@ -18,9 +18,9 @@ #include "mojo/shell/application_loader.h" #include "mojo/shell/application_manager.h" #include "mojo/shell/package_manager/package_manager_impl.h" -#include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/interface_factory.h" #include "mojo/shell/public/cpp/shell_client.h" +#include "mojo/shell/public/cpp/shell_connection.h" #include "mojo/shell/public/interfaces/content_handler.mojom.h" #include "mojo/util/filename_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -55,7 +55,7 @@ class TestContentHandler : public ShellClient, // Overridden from mojom::ContentHandler: void StartApplication( - InterfaceRequest<mojom::Application> application, + InterfaceRequest<mojom::ShellClient> request, URLResponsePtr response, const Callback<void()>& destruct_callback) override { response_number_++; @@ -84,12 +84,12 @@ class TestLoader : public ApplicationLoader { private: // Overridden from ApplicationLoader: void Load(const GURL& url, - InterfaceRequest<mojom::Application> request) override { - app_.reset(new ApplicationImpl(delegate_, std::move(request))); + InterfaceRequest<mojom::ShellClient> request) override { + app_.reset(new ShellConnection(delegate_, std::move(request))); } ShellClient* delegate_; - scoped_ptr<ApplicationImpl> app_; + scoped_ptr<ShellConnection> app_; DISALLOW_COPY_AND_ASSIGN(TestLoader); }; diff --git a/mojo/shell/native_runner.h b/mojo/shell/native_runner.h index ea99a75..6ab587b4 100644 --- a/mojo/shell/native_runner.h +++ b/mojo/shell/native_runner.h @@ -9,7 +9,7 @@ #include "base/memory/scoped_ptr.h" #include "base/process/process_handle.h" #include "mojo/public/cpp/bindings/interface_request.h" -#include "mojo/shell/public/interfaces/application.mojom.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" #if defined(OS_WIN) #undef DELETE @@ -33,15 +33,14 @@ class NativeRunner { virtual void Start( const base::FilePath& app_path, bool start_sandboxed, - InterfaceRequest<mojom::Application> application_request, + InterfaceRequest<mojom::ShellClient> request, const base::Callback<void(base::ProcessId)>& pid_available_callback, const base::Closure& app_completed_callback) = 0; // Like Start(), but used to initialize the host for a child process started - // by someone else. Provides |application_request| via |channel|. - virtual void InitHost( - ScopedHandle channel, - InterfaceRequest<mojom::Application> application_request) = 0; + // by someone else. Provides |request| via |channel|. + virtual void InitHost(ScopedHandle channel, + InterfaceRequest<mojom::ShellClient> request) = 0; }; class NativeRunnerFactory { diff --git a/mojo/shell/package_manager.h b/mojo/shell/package_manager.h index 1ffae75..80b5b8b 100644 --- a/mojo/shell/package_manager.h +++ b/mojo/shell/package_manager.h @@ -10,7 +10,7 @@ #include "mojo/services/network/public/interfaces/url_loader.mojom.h" #include "mojo/shell/capability_filter.h" #include "mojo/shell/fetcher.h" -#include "mojo/shell/public/interfaces/application.mojom.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" class GURL; @@ -44,7 +44,7 @@ class PackageManager { // content handler. // |target_filter| is a CapabilityFilter that should be applied if a content // handler is started to handle |target_url|. - // |application_request| is a request for an Application implementation that + // |request| is a request for an Application implementation that // will be taken by ContentHandler::StartApplication if a content handler ends // up handling |target_url|. virtual uint32_t HandleWithContentHandler( @@ -52,7 +52,7 @@ class PackageManager { const Identity& source, const GURL& target_url, const CapabilityFilter& target_filter, - InterfaceRequest<shell::mojom::Application>* application_request) = 0; + InterfaceRequest<shell::mojom::ShellClient>* request) = 0; // Returns true if a manifest for |url| exists within the PackageManager's // application catalog. diff --git a/mojo/shell/package_manager/capability_filter_content_handler_unittest.cc b/mojo/shell/package_manager/capability_filter_content_handler_unittest.cc index fe88fe9..924cba3 100644 --- a/mojo/shell/package_manager/capability_filter_content_handler_unittest.cc +++ b/mojo/shell/package_manager/capability_filter_content_handler_unittest.cc @@ -12,9 +12,9 @@ #include "mojo/shell/capability_filter_test.h" #include "mojo/shell/fetcher.h" #include "mojo/shell/package_manager/package_manager_impl.h" -#include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/interface_factory.h" #include "mojo/shell/public/cpp/shell_client.h" +#include "mojo/shell/public/cpp/shell_connection.h" #include "mojo/shell/public/interfaces/content_handler.mojom.h" #include "testing/gtest/include/gtest/gtest.h" @@ -98,20 +98,19 @@ class TestContentHandler : public ShellClient, } // Overridden from mojom::ContentHandler: - void StartApplication( - InterfaceRequest<mojom::Application> application, - URLResponsePtr response, - const Callback<void()>& destruct_callback) override { + void StartApplication(InterfaceRequest<mojom::ShellClient> request, + URLResponsePtr response, + const Callback<void()>& destruct_callback) override { scoped_ptr<ShellClient> delegate(new test::TestApplication); embedded_apps_.push_back( - new ApplicationImpl(delegate.get(), std::move(application))); + new ShellConnection(delegate.get(), std::move(request))); embedded_app_delegates_.push_back(std::move(delegate)); destruct_callback.Run(); } WeakBindingSet<mojom::ContentHandler> bindings_; ScopedVector<ShellClient> embedded_app_delegates_; - ScopedVector<ApplicationImpl> embedded_apps_; + ScopedVector<ShellConnection> embedded_apps_; DISALLOW_COPY_AND_ASSIGN(TestContentHandler); }; diff --git a/mojo/shell/package_manager/content_handler_connection.cc b/mojo/shell/package_manager/content_handler_connection.cc index 7271fb8..2bddab0 100644 --- a/mojo/shell/package_manager/content_handler_connection.cc +++ b/mojo/shell/package_manager/content_handler_connection.cc @@ -46,7 +46,7 @@ ContentHandlerConnection::ContentHandlerConnection( } void ContentHandlerConnection::StartApplication( - InterfaceRequest<mojom::Application> request, + InterfaceRequest<mojom::ShellClient> request, URLResponsePtr response) { content_handler_->StartApplication( std::move(request), std::move(response), diff --git a/mojo/shell/package_manager/content_handler_connection.h b/mojo/shell/package_manager/content_handler_connection.h index c1c4551..11d3b70 100644 --- a/mojo/shell/package_manager/content_handler_connection.h +++ b/mojo/shell/package_manager/content_handler_connection.h @@ -35,7 +35,7 @@ class ContentHandlerConnection { uint32_t id, const ClosedCallback& connection_closed_callback); - void StartApplication(InterfaceRequest<mojom::Application> request, + void StartApplication(InterfaceRequest<mojom::ShellClient> request, URLResponsePtr response); // Closes the connection and destroys |this| object. diff --git a/mojo/shell/package_manager/content_handler_unittest.cc b/mojo/shell/package_manager/content_handler_unittest.cc index 4d743af..93e1d90 100644 --- a/mojo/shell/package_manager/content_handler_unittest.cc +++ b/mojo/shell/package_manager/content_handler_unittest.cc @@ -19,9 +19,9 @@ #include "mojo/shell/connect_util.h" #include "mojo/shell/fetcher.h" #include "mojo/shell/package_manager/package_manager_impl.h" -#include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/interface_factory.h" #include "mojo/shell/public/cpp/shell_client.h" +#include "mojo/shell/public/cpp/shell_connection.h" #include "mojo/shell/public/interfaces/content_handler.mojom.h" #include "mojo/shell/public/interfaces/service_provider.mojom.h" #include "mojo/shell/test_package_manager.h" @@ -72,7 +72,7 @@ void QuitClosure(bool* value) { } class TestContentHandler : public mojom::ContentHandler, - public ShellClient{ + public ShellClient { public: TestContentHandler(Connection* connection, InterfaceRequest<mojom::ContentHandler> request) @@ -80,16 +80,16 @@ class TestContentHandler : public mojom::ContentHandler, // ContentHandler: void StartApplication( - InterfaceRequest<mojom::Application> application_request, + InterfaceRequest<mojom::ShellClient> request, URLResponsePtr response, const Callback<void()>& destruct_callback) override { - apps_.push_back(new ApplicationImpl(this, std::move(application_request))); + shell_connections_.push_back(new ShellConnection(this, std::move(request))); destruct_callback.Run(); } private: StrongBinding<mojom::ContentHandler> binding_; - ScopedVector<ApplicationImpl> apps_; + ScopedVector<ShellConnection> shell_connections_; DISALLOW_COPY_AND_ASSIGN(TestContentHandler); }; @@ -107,9 +107,9 @@ class TestApplicationLoader : public ApplicationLoader, private: // ApplicationLoader implementation. void Load(const GURL& url, - InterfaceRequest<mojom::Application> application_request) override { + InterfaceRequest<mojom::ShellClient> request) override { ++num_loads_; - test_app_.reset(new ApplicationImpl(this, std::move(application_request))); + shell_connection_.reset(new ShellConnection(this, std::move(request))); } // mojo::ShellClient implementation. @@ -124,7 +124,7 @@ class TestApplicationLoader : public ApplicationLoader, new TestContentHandler(connection, std::move(request)); } - scoped_ptr<ApplicationImpl> test_app_; + scoped_ptr<ShellConnection> shell_connection_; int num_loads_; GURL last_requestor_url_; diff --git a/mojo/shell/package_manager/package_manager_impl.cc b/mojo/shell/package_manager/package_manager_impl.cc index 6985381..a639bc3 100644 --- a/mojo/shell/package_manager/package_manager_impl.cc +++ b/mojo/shell/package_manager/package_manager_impl.cc @@ -181,7 +181,7 @@ uint32_t PackageManagerImpl::HandleWithContentHandler( const Identity& source, const GURL& target_url, const CapabilityFilter& target_filter, - InterfaceRequest<mojom::Application>* application_request) { + InterfaceRequest<mojom::ShellClient>* request) { Identity content_handler_identity; URLResponsePtr response; if (ShouldHandleWithContentHandler(fetcher, @@ -191,8 +191,7 @@ uint32_t PackageManagerImpl::HandleWithContentHandler( &response)) { ContentHandlerConnection* connection = GetContentHandler(content_handler_identity, source); - connection->StartApplication(std::move(*application_request), - std::move(response)); + connection->StartApplication(std::move(*request), std::move(response)); return connection->id(); } return mojom::Shell::kInvalidApplicationID; diff --git a/mojo/shell/package_manager/package_manager_impl.h b/mojo/shell/package_manager/package_manager_impl.h index fdef369..ee215a6 100644 --- a/mojo/shell/package_manager/package_manager_impl.h +++ b/mojo/shell/package_manager/package_manager_impl.h @@ -98,7 +98,7 @@ class PackageManagerImpl : public PackageManager { const Identity& source, const GURL& target_url, const CapabilityFilter& target_filter, - InterfaceRequest<mojom::Application>* application_request) override; + InterfaceRequest<mojom::ShellClient>* request) override; bool IsURLInCatalog(const std::string& url) const override; std::string GetApplicationName(const std::string& url) const override; diff --git a/mojo/shell/public/cpp/BUILD.gn b/mojo/shell/public/cpp/BUILD.gn index 32a156d..3dcc86b 100644 --- a/mojo/shell/public/cpp/BUILD.gn +++ b/mojo/shell/public/cpp/BUILD.gn @@ -21,7 +21,6 @@ source_set("cpp_for_chromium") { source_set("sources") { sources = [ "app_lifetime_helper.h", - "application_impl.h", "application_runner.h", "connect.h", "connection.h", @@ -29,15 +28,16 @@ source_set("sources") { "interface_factory.h", "interface_factory_impl.h", "lib/app_lifetime_helper.cc", - "lib/application_impl.cc", "lib/application_runner.cc", "lib/connection_impl.cc", "lib/connection_impl.h", "lib/interface_factory_connector.h", "lib/shell_client.cc", + "lib/shell_connection.cc", "service_connector.h", "shell.h", "shell_client.h", + "shell_connection.h", ] deps = [ diff --git a/mojo/shell/public/cpp/app_lifetime_helper.h b/mojo/shell/public/cpp/app_lifetime_helper.h index ae2503f..14620b3a 100644 --- a/mojo/shell/public/cpp/app_lifetime_helper.h +++ b/mojo/shell/public/cpp/app_lifetime_helper.h @@ -11,7 +11,7 @@ namespace mojo { -class ApplicationImpl; +class ShellConnection; class AppLifetimeHelper; // A service implementation should keep this object as a member variable to hold @@ -54,10 +54,10 @@ class AppRefCount { // creates an instance of a service, it gives it a refcount using // CreateAppRefCount. The service implementation then keeps that object as a // member variable. When all the service implemenations go away, the app will be -// quit with a call to mojo::ApplicationImpl::Terminate(). +// quit with a call to mojo::ShellConnection::Terminate(). class AppLifetimeHelper { public: - explicit AppLifetimeHelper(ApplicationImpl* app); + explicit AppLifetimeHelper(ShellConnection* app); ~AppLifetimeHelper(); scoped_ptr<AppRefCount> CreateAppRefCount(); @@ -67,10 +67,10 @@ class AppLifetimeHelper { void AddRef(); void Release(); - friend ApplicationImpl; + friend ShellConnection; void OnQuit(); - ApplicationImpl* app_; + ShellConnection* app_; int ref_count_; DISALLOW_COPY_AND_ASSIGN(AppLifetimeHelper); diff --git a/mojo/shell/public/cpp/application_runner.h b/mojo/shell/public/cpp/application_runner.h index ddebcd7..c9b2baa 100644 --- a/mojo/shell/public/cpp/application_runner.h +++ b/mojo/shell/public/cpp/application_runner.h @@ -35,7 +35,7 @@ class ApplicationRunner { void set_message_loop_type(base::MessageLoop::Type type); // Once the various parameters have been set above, use Run to initialize an - // ApplicationImpl wired to the provided delegate, and run a MessageLoop until + // ShellConnection wired to the provided delegate, and run a MessageLoop until // the application exits. // // Iff |init_base| is true, the runner will perform some initialization of diff --git a/mojo/shell/public/cpp/application_test_base.h b/mojo/shell/public/cpp/application_test_base.h index eec60d8..f8ff6ad 100644 --- a/mojo/shell/public/cpp/application_test_base.h +++ b/mojo/shell/public/cpp/application_test_base.h @@ -9,22 +9,22 @@ #include "mojo/public/cpp/bindings/array.h" #include "mojo/public/cpp/bindings/string.h" #include "mojo/public/cpp/system/macros.h" -#include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/shell_client.h" -#include "mojo/shell/public/interfaces/application.mojom.h" +#include "mojo/shell/public/cpp/shell_connection.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" #include "testing/gtest/include/gtest/gtest.h" namespace mojo { -class ApplicationImpl; +class ShellConnection; namespace test { // Run all application tests. This must be called after the environment is // initialized, to support construction of a default run loop. -MojoResult RunAllTests(MojoHandle application_request_handle); +MojoResult RunAllTests(MojoHandle shell_client_request_handle); -// Used to configure the ApplicationImpl. This is used internally by +// Used to configure the ShellConnection. This is used internally by // ApplicationTestBase, but useful if you do not want to subclass // ApplicationTestBase. class TestHelper { @@ -32,7 +32,7 @@ class TestHelper { explicit TestHelper(ShellClient* client); ~TestHelper(); - Shell* shell() { return application_impl_.get(); } + Shell* shell() { return shell_connection_.get(); } std::string shell_url() { return url_; } private: @@ -40,7 +40,7 @@ class TestHelper { ShellClient default_shell_client_; // The application implementation instance, reconstructed for each test. - scoped_ptr<ApplicationImpl> application_impl_; + scoped_ptr<ShellConnection> shell_connection_; std::string url_; diff --git a/mojo/shell/public/cpp/connection.h b/mojo/shell/public/cpp/connection.h index a21657f..f4c3c19 100644 --- a/mojo/shell/public/cpp/connection.h +++ b/mojo/shell/public/cpp/connection.h @@ -43,7 +43,7 @@ class ServiceConnector; // // Just as with InterfaceFactory, ServiceConnector must outlive Connection. // -// An Connection's lifetime is managed by an ApplicationImpl. To close a +// An Connection's lifetime is managed by an ShellConnection. To close a // connection, call CloseConnection which will destroy this object. class Connection { public: diff --git a/mojo/shell/public/cpp/content_handler_factory.h b/mojo/shell/public/cpp/content_handler_factory.h index a174cdd..9e3c5ff 100644 --- a/mojo/shell/public/cpp/content_handler_factory.h +++ b/mojo/shell/public/cpp/content_handler_factory.h @@ -28,7 +28,7 @@ class ContentHandlerFactory // 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<shell::mojom::Application> application_request, + InterfaceRequest<shell::mojom::ShellClient> request, URLResponsePtr response) = 0; }; @@ -40,13 +40,12 @@ class ContentHandlerFactory // on this new thread, and the returned value will be kept alive until the // application ends. virtual scoped_ptr<HandledApplicationHolder> CreateApplication( - InterfaceRequest<shell::mojom::Application> application_request, + InterfaceRequest<shell::mojom::ShellClient> request, URLResponsePtr response) = 0; private: - void RunApplication( - InterfaceRequest<shell::mojom::Application> application_request, - URLResponsePtr response) override; + void RunApplication(InterfaceRequest<shell::mojom::ShellClient> request, + URLResponsePtr response) override; }; explicit ContentHandlerFactory(Delegate* delegate); diff --git a/mojo/shell/public/cpp/lib/app_lifetime_helper.cc b/mojo/shell/public/cpp/lib/app_lifetime_helper.cc index 0772412a..b2a95a7 100644 --- a/mojo/shell/public/cpp/lib/app_lifetime_helper.cc +++ b/mojo/shell/public/cpp/lib/app_lifetime_helper.cc @@ -6,7 +6,7 @@ #include "base/bind.h" #include "base/message_loop/message_loop.h" -#include "mojo/shell/public/cpp/application_impl.h" +#include "mojo/shell/public/cpp/shell_connection.h" namespace mojo { @@ -63,7 +63,7 @@ scoped_ptr<AppRefCount> AppRefCount::Clone() { app_lifetime_helper_, app_task_runner_)); } -AppLifetimeHelper::AppLifetimeHelper(ApplicationImpl* app) +AppLifetimeHelper::AppLifetimeHelper(ShellConnection* app) : app_(app), ref_count_(0) { } diff --git a/mojo/shell/public/cpp/lib/application_runner.cc b/mojo/shell/public/cpp/lib/application_runner.cc index 245dcd5..c4aba6d 100644 --- a/mojo/shell/public/cpp/lib/application_runner.cc +++ b/mojo/shell/public/cpp/lib/application_runner.cc @@ -10,8 +10,8 @@ #include "base/message_loop/message_loop.h" #include "base/process/launch.h" #include "mojo/message_pump/message_pump_mojo.h" -#include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/shell_client.h" +#include "mojo/shell/public/cpp/shell_connection.h" namespace mojo { @@ -36,7 +36,7 @@ void ApplicationRunner::set_message_loop_type(base::MessageLoop::Type type) { message_loop_type_ = type; } -MojoResult ApplicationRunner::Run(MojoHandle application_request_handle, +MojoResult ApplicationRunner::Run(MojoHandle shell_client_request_handle, bool init_base) { DCHECK(!has_run_); has_run_ = true; @@ -54,10 +54,10 @@ MojoResult ApplicationRunner::Run(MojoHandle application_request_handle, else loop.reset(new base::MessageLoop(message_loop_type_)); - ApplicationImpl impl(client_.get(), - MakeRequest<shell::mojom::Application>( + ShellConnection impl(client_.get(), + MakeRequest<shell::mojom::ShellClient>( MakeScopedHandle(MessagePipeHandle( - application_request_handle)))); + shell_client_request_handle)))); loop->Run(); // It's very common for the client to cache the app and terminate on errors. // If we don't delete the client before the app we run the risk of the @@ -71,8 +71,8 @@ MojoResult ApplicationRunner::Run(MojoHandle application_request_handle, return MOJO_RESULT_OK; } -MojoResult ApplicationRunner::Run(MojoHandle application_request_handle) { - return Run(application_request_handle, true); +MojoResult ApplicationRunner::Run(MojoHandle shell_client_request_handle) { + return Run(shell_client_request_handle, true); } } // namespace mojo diff --git a/mojo/shell/public/cpp/lib/application_test_base.cc b/mojo/shell/public/cpp/lib/application_test_base.cc index 2bf6975..2349543 100644 --- a/mojo/shell/public/cpp/lib/application_test_base.cc +++ b/mojo/shell/public/cpp/lib/application_test_base.cc @@ -9,9 +9,9 @@ #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/environment/environment.h" #include "mojo/public/cpp/system/message_pipe.h" -#include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/application_test_base.h" -#include "mojo/shell/public/interfaces/application.mojom.h" +#include "mojo/shell/public/cpp/shell_connection.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" namespace mojo { namespace test { @@ -21,34 +21,33 @@ namespace { String g_url; 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<shell::mojom::Application> g_application_request; +// ShellClient request handle passed from the shell in MojoMain, stored in +// between SetUp()/TearDown() so we can (re-)intialize new ShellConnections. +InterfaceRequest<shell::mojom::ShellClient> g_shell_client_request; -// Shell pointer passed in the initial mojo.Application.Initialize() call, +// Shell pointer passed in the initial mojo.ShellClient.Initialize() call, // stored in between initial setup and the first test and between SetUp/TearDown -// calls so we can (re-)initialize new ApplicationImpls. +// calls so we can (re-)initialize new ShellConnections. shell::mojom::ShellPtr g_shell; -class ShellGrabber : public shell::mojom::Application { +class ShellGrabber : public shell::mojom::ShellClient { public: - explicit ShellGrabber( - InterfaceRequest<shell::mojom::Application> application_request) - : binding_(this, std::move(application_request)) {} + explicit ShellGrabber(InterfaceRequest<shell::mojom::ShellClient> request) + : binding_(this, std::move(request)) {} void WaitForInitialize() { - // Initialize is always the first call made on Application. + // Initialize is always the first call made on ShellClient. MOJO_CHECK(binding_.WaitForIncomingMethodCall()); } private: - // Application implementation. + // shell::mojom::ShellClient implementation. void Initialize(shell::mojom::ShellPtr shell, const mojo::String& url, uint32_t id) override { g_url = url; g_id = id; - g_application_request = binding_.Unbind(); + g_shell_client_request = binding_.Unbind(); g_shell = std::move(shell); } @@ -65,23 +64,23 @@ class ShellGrabber : public shell::mojom::Application { MOJO_CHECK(false); } - Binding<Application> binding_; + Binding<ShellClient> binding_; }; } // namespace -MojoResult RunAllTests(MojoHandle application_request_handle) { +MojoResult RunAllTests(MojoHandle shell_client_request_handle) { { // This loop is used for init, and then destroyed before running tests. Environment::InstantiateDefaultRunLoop(); // Grab the shell handle. ShellGrabber grabber( - MakeRequest<shell::mojom::Application>(MakeScopedHandle( - MessagePipeHandle(application_request_handle)))); + MakeRequest<shell::mojom::ShellClient>(MakeScopedHandle( + MessagePipeHandle(shell_client_request_handle)))); grabber.WaitForInitialize(); MOJO_CHECK(g_shell); - MOJO_CHECK(g_application_request.is_pending()); + MOJO_CHECK(g_shell_client_request.is_pending()); int argc = 0; base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); @@ -107,31 +106,31 @@ MojoResult RunAllTests(MojoHandle application_request_handle) { int result = RUN_ALL_TESTS(); // Shut down our message pipes before exiting. - (void)g_application_request.PassMessagePipe(); + (void)g_shell_client_request.PassMessagePipe(); g_shell.reset(); return (result == 0) ? MOJO_RESULT_OK : MOJO_RESULT_UNKNOWN; } TestHelper::TestHelper(ShellClient* client) - : application_impl_(new ApplicationImpl( + : shell_connection_(new ShellConnection( client == nullptr ? &default_shell_client_ : client, - std::move(g_application_request))), + std::move(g_shell_client_request))), url_(g_url) { - // Fake application initialization. - shell::mojom::Application* application = application_impl_.get(); - application->Initialize(std::move(g_shell), g_url, g_id); + // Fake ShellClient initialization. + shell::mojom::ShellClient* shell_client = shell_connection_.get(); + shell_client->Initialize(std::move(g_shell), g_url, g_id); } TestHelper::~TestHelper() { // TODO: commented out until http://crbug.com/533107 is solved. // { - // ApplicationImpl::TestApi test_api(application_impl_); - // test_api.UnbindConnections(&g_application_request, &g_shell); + // ShellConnection::TestApi test_api(shell_connection_); + // test_api.UnbindConnections(&g_shell_client_request, &g_shell); // } - // We may have supplied a member as the client. Delete |application_impl_| + // We may have supplied a member as the client. Delete |shell_connection_| // while still valid. - application_impl_.reset(); + shell_connection_.reset(); } ApplicationTestBase::ApplicationTestBase() : test_helper_(nullptr) {} @@ -144,12 +143,12 @@ ShellClient* ApplicationTestBase::GetShellClient() { } void ApplicationTestBase::SetUp() { - // A run loop is recommended for ApplicationImpl initialization and + // A run loop is recommended for ShellConnection initialization and // communication. if (ShouldCreateDefaultRunLoop()) Environment::InstantiateDefaultRunLoop(); - MOJO_CHECK(g_application_request.is_pending()); + MOJO_CHECK(g_shell_client_request.is_pending()); MOJO_CHECK(g_shell); // New applications are constructed for each test to avoid persisting state. @@ -157,7 +156,7 @@ void ApplicationTestBase::SetUp() { } void ApplicationTestBase::TearDown() { - MOJO_CHECK(!g_application_request.is_pending()); + MOJO_CHECK(!g_shell_client_request.is_pending()); MOJO_CHECK(!g_shell); test_helper_.reset(); diff --git a/mojo/shell/public/cpp/lib/content_handler_factory.cc b/mojo/shell/public/cpp/lib/content_handler_factory.cc index 156faf0..74b788c 100644 --- a/mojo/shell/public/cpp/lib/content_handler_factory.cc +++ b/mojo/shell/public/cpp/lib/content_handler_factory.cc @@ -29,13 +29,13 @@ class ApplicationThread : public base::PlatformThread::Delegate { scoped_refptr<base::SingleThreadTaskRunner> handler_thread, const base::Callback<void(ApplicationThread*)>& termination_callback, ContentHandlerFactory::Delegate* handler_delegate, - InterfaceRequest<shell::mojom::Application> application_request, + InterfaceRequest<shell::mojom::ShellClient> request, URLResponsePtr response, const Callback<void()>& destruct_callback) : handler_thread_(handler_thread), termination_callback_(termination_callback), handler_delegate_(handler_delegate), - application_request_(std::move(application_request)), + request_(std::move(request)), response_(std::move(response)), destruct_callback_(destruct_callback) {} @@ -45,7 +45,7 @@ class ApplicationThread : public base::PlatformThread::Delegate { private: void ThreadMain() override { - handler_delegate_->RunApplication(std::move(application_request_), + handler_delegate_->RunApplication(std::move(request_), std::move(response_)); handler_thread_->PostTask(FROM_HERE, base::Bind(termination_callback_, this)); @@ -54,7 +54,7 @@ class ApplicationThread : public base::PlatformThread::Delegate { scoped_refptr<base::SingleThreadTaskRunner> handler_thread_; base::Callback<void(ApplicationThread*)> termination_callback_; ContentHandlerFactory::Delegate* handler_delegate_; - InterfaceRequest<shell::mojom::Application> application_request_; + InterfaceRequest<shell::mojom::ShellClient> request_; URLResponsePtr response_; Callback<void()> destruct_callback_; @@ -82,15 +82,14 @@ class ContentHandlerImpl : public shell::mojom::ContentHandler { private: // Overridden from ContentHandler: - void StartApplication( - InterfaceRequest<shell::mojom::Application> application_request, - URLResponsePtr response, - const Callback<void()>& destruct_callback) override { + void StartApplication(InterfaceRequest<shell::mojom::ShellClient> request, + URLResponsePtr response, + const Callback<void()>& destruct_callback) override { ApplicationThread* thread = new ApplicationThread(base::ThreadTaskRunnerHandle::Get(), base::Bind(&ContentHandlerImpl::OnThreadEnd, weak_factory_.GetWeakPtr()), - delegate_, std::move(application_request), + delegate_, std::move(request), std::move(response), destruct_callback); base::PlatformThreadHandle handle; bool launched = base::PlatformThread::Create(0, thread, &handle); @@ -124,11 +123,11 @@ ContentHandlerFactory::~ContentHandlerFactory() { } void ContentHandlerFactory::ManagedDelegate::RunApplication( - InterfaceRequest<shell::mojom::Application> application_request, + InterfaceRequest<shell::mojom::ShellClient> request, URLResponsePtr response) { base::MessageLoop loop(common::MessagePumpMojo::Create()); - auto application = this->CreateApplication(std::move(application_request), - std::move(response)); + auto application = + this->CreateApplication(std::move(request), std::move(response)); if (application) loop.Run(); } diff --git a/mojo/shell/public/cpp/lib/application_impl.cc b/mojo/shell/public/cpp/lib/shell_connection.cc index bba8cb8..3cc4d02 100644 --- a/mojo/shell/public/cpp/lib/application_impl.cc +++ b/mojo/shell/public/cpp/lib/shell_connection.cc @@ -10,9 +10,9 @@ #include "mojo/converters/network/network_type_converters.h" #include "mojo/public/cpp/bindings/interface_ptr.h" #include "mojo/public/cpp/environment/logging.h" -#include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/lib/connection_impl.h" #include "mojo/shell/public/cpp/shell_client.h" +#include "mojo/shell/public/cpp/shell_connection.h" namespace mojo { @@ -26,25 +26,25 @@ void DefaultTerminationClosure() { } // namespace -ApplicationImpl::ConnectParams::ConnectParams(const std::string& url) +ShellConnection::ConnectParams::ConnectParams(const std::string& url) : ConnectParams(URLRequest::From(url)) {} -ApplicationImpl::ConnectParams::ConnectParams(URLRequestPtr request) +ShellConnection::ConnectParams::ConnectParams(URLRequestPtr request) : request_(std::move(request)), filter_(shell::mojom::CapabilityFilter::New()) { filter_->filter.mark_non_null(); } -ApplicationImpl::ConnectParams::~ConnectParams() {} +ShellConnection::ConnectParams::~ConnectParams() {} -ApplicationImpl::ApplicationImpl( - ShellClient* client, - InterfaceRequest<shell::mojom::Application> request) - : ApplicationImpl(client, +ShellConnection::ShellConnection( + mojo::ShellClient* client, + InterfaceRequest<shell::mojom::ShellClient> request) + : ShellConnection(client, std::move(request), base::Bind(&DefaultTerminationClosure)) {} -ApplicationImpl::ApplicationImpl( - ShellClient* client, - InterfaceRequest<shell::mojom::Application> request, +ShellConnection::ShellConnection( + mojo::ShellClient* client, + InterfaceRequest<shell::mojom::ShellClient> request, const Closure& termination_closure) : client_(client), binding_(this, std::move(request)), @@ -53,22 +53,22 @@ ApplicationImpl::ApplicationImpl( quit_requested_(false), weak_factory_(this) {} -ApplicationImpl::~ApplicationImpl() { +ShellConnection::~ShellConnection() { app_lifetime_helper_.OnQuit(); } -void ApplicationImpl::WaitForInitialize() { +void ShellConnection::WaitForInitialize() { DCHECK(!shell_.is_bound()); binding_.WaitForIncomingMethodCall(); } -scoped_ptr<Connection> ApplicationImpl::Connect(const std::string& url) { +scoped_ptr<Connection> ShellConnection::Connect(const std::string& url) { ConnectParams params(url); params.set_filter(CreatePermissiveCapabilityFilter()); return Connect(¶ms); } -scoped_ptr<Connection> ApplicationImpl::Connect(ConnectParams* params) { +scoped_ptr<Connection> ShellConnection::Connect(ConnectParams* params) { if (!shell_) return nullptr; DCHECK(params); @@ -96,7 +96,7 @@ scoped_ptr<Connection> ApplicationImpl::Connect(ConnectParams* params) { return std::move(registry); } -void ApplicationImpl::Quit() { +void ShellConnection::Quit() { // We can't quit immediately, since there could be in-flight requests from the // shell. So check with it first. if (shell_) { @@ -107,11 +107,11 @@ void ApplicationImpl::Quit() { } } -scoped_ptr<AppRefCount> ApplicationImpl::CreateAppRefCount() { +scoped_ptr<AppRefCount> ShellConnection::CreateAppRefCount() { return app_lifetime_helper_.CreateAppRefCount(); } -void ApplicationImpl::Initialize(shell::mojom::ShellPtr shell, +void ShellConnection::Initialize(shell::mojom::ShellPtr shell, const mojo::String& url, uint32_t id) { shell_ = std::move(shell); @@ -119,7 +119,7 @@ void ApplicationImpl::Initialize(shell::mojom::ShellPtr shell, client_->Initialize(this, url, id); } -void ApplicationImpl::AcceptConnection( +void ShellConnection::AcceptConnection( const String& requestor_url, uint32_t requestor_id, InterfaceRequest<ServiceProvider> services, @@ -140,7 +140,7 @@ void ApplicationImpl::AcceptConnection( incoming_connections_.push_back(std::move(registry)); } -void ApplicationImpl::OnQuitRequested(const Callback<void(bool)>& callback) { +void ShellConnection::OnQuitRequested(const Callback<void(bool)>& callback) { // If by the time we got the reply from the shell, more requests had come in // then we don't want to quit the app anymore so we return false. Otherwise // |quit_requested_| is true so we tell the shell to proceed with the quit. @@ -149,8 +149,8 @@ void ApplicationImpl::OnQuitRequested(const Callback<void(bool)>& callback) { QuitNow(); } -void ApplicationImpl::OnConnectionError() { - base::WeakPtr<ApplicationImpl> ptr(weak_factory_.GetWeakPtr()); +void ShellConnection::OnConnectionError() { + base::WeakPtr<ShellConnection> ptr(weak_factory_.GetWeakPtr()); // We give the client notice first, since it might want to do something on // shell connection errors other than immediate termination of the run @@ -164,15 +164,15 @@ void ApplicationImpl::OnConnectionError() { shell_ = nullptr; } -void ApplicationImpl::QuitNow() { +void ShellConnection::QuitNow() { client_->Quit(); termination_closure_.Run(); } -void ApplicationImpl::UnbindConnections( - InterfaceRequest<shell::mojom::Application>* application_request, +void ShellConnection::UnbindConnections( + InterfaceRequest<shell::mojom::ShellClient>* request, shell::mojom::ShellPtr* shell) { - *application_request = binding_.Unbind(); + *request = binding_.Unbind(); shell->Bind(shell_.PassInterface()); } diff --git a/mojo/shell/public/cpp/shell.h b/mojo/shell/public/cpp/shell.h index 104cc45..25518c3 100644 --- a/mojo/shell/public/cpp/shell.h +++ b/mojo/shell/public/cpp/shell.h @@ -7,14 +7,14 @@ #include "mojo/shell/public/cpp/app_lifetime_helper.h" #include "mojo/shell/public/cpp/connection.h" -#include "mojo/shell/public/interfaces/application.mojom.h" #include "mojo/shell/public/interfaces/shell.mojom.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" namespace mojo { shell::mojom::CapabilityFilterPtr CreatePermissiveCapabilityFilter(); -using ApplicationRequest = InterfaceRequest<shell::mojom::Application>; +using ShellClientRequest = InterfaceRequest<shell::mojom::ShellClient>; class Shell { public: diff --git a/mojo/shell/public/cpp/shell_client.h b/mojo/shell/public/cpp/shell_client.h index e7c56d9..ae3ad52 100644 --- a/mojo/shell/public/cpp/shell_client.h +++ b/mojo/shell/public/cpp/shell_client.h @@ -16,7 +16,7 @@ namespace mojo { class Shell; // An abstract class that the application may subclass to control various -// behaviors of ApplicationImpl. +// behaviors of ShellConnection. class ShellClient { public: ShellClient(); @@ -38,10 +38,10 @@ class ShellClient { // // Return true to shutdown the application. Return false to skip shutting // down the connection, but user is then required to call - // ApplicationImpl::QuitNow() when done. Default implementation returns true. + // ShellConnection::QuitNow() when done. Default implementation returns true. virtual bool ShellConnectionLost(); - // Called before ApplicationImpl::Terminate(). After returning from this call + // Called before ShellConnection::Terminate(). After returning from this call // the delegate can no longer rely on the main run loop still running. virtual void Quit(); diff --git a/mojo/shell/public/cpp/application_impl.h b/mojo/shell/public/cpp/shell_connection.h index 9c30796..c58150a 100644 --- a/mojo/shell/public/cpp/application_impl.h +++ b/mojo/shell/public/cpp/shell_connection.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MOJO_SHELL_PUBLIC_CPP_APPLICATION_IMPL_H_ -#define MOJO_SHELL_PUBLIC_CPP_APPLICATION_IMPL_H_ +#ifndef MOJO_SHELL_PUBLIC_CPP_SHELL_CONNECTION_H_ +#define MOJO_SHELL_PUBLIC_CPP_SHELL_CONNECTION_H_ #include <utility> #include <vector> @@ -17,8 +17,8 @@ #include "mojo/shell/public/cpp/app_lifetime_helper.h" #include "mojo/shell/public/cpp/shell.h" #include "mojo/shell/public/cpp/shell_client.h" -#include "mojo/shell/public/interfaces/application.mojom.h" #include "mojo/shell/public/interfaces/shell.mojom.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" namespace mojo { @@ -47,48 +47,43 @@ namespace mojo { // BarImpl(ApplicationContext* app_context, BarContext* service_context) // : app_context_(app_context), servicecontext_(context) {} // -// Create an ApplicationImpl instance that collects any service implementations. +// Create an ShellConnection instance that collects any service implementations. // -// ApplicationImpl app(service_provider_handle); +// ShellConnection app(service_provider_handle); // app.AddService<FooImpl>(); // // BarContext context; // app.AddService<BarImpl>(&context); // // -class ApplicationImpl : public Shell, public shell::mojom::Application { +class ShellConnection : public Shell, public shell::mojom::ShellClient { public: class TestApi { public: - explicit TestApi(ApplicationImpl* application) - : application_(application) {} + explicit TestApi(ShellConnection* shell_connection) + : shell_connection_(shell_connection) {} void UnbindConnections( - InterfaceRequest<shell::mojom::Application>* application_request, + InterfaceRequest<shell::mojom::ShellClient>* request, shell::mojom::ShellPtr* shell) { - application_->UnbindConnections(application_request, shell); + shell_connection_->UnbindConnections(request, shell); } private: - ApplicationImpl* application_; + ShellConnection* shell_connection_; }; // Does not take ownership of |delegate|, which must remain valid for the - // lifetime of ApplicationImpl. - ApplicationImpl(ShellClient* client, - InterfaceRequest<shell::mojom::Application> request); - // Constructs an ApplicationImpl with a custom termination closure. This + // lifetime of ShellConnection. + ShellConnection(mojo::ShellClient* client, + InterfaceRequest<shell::mojom::ShellClient> request); + // Constructs an ShellConnection with a custom termination closure. This // closure is invoked on Quit() instead of the default behavior of quitting // the current base::MessageLoop. - ApplicationImpl(ShellClient* client, - InterfaceRequest<shell::mojom::Application> request, + ShellConnection(mojo::ShellClient* client, + InterfaceRequest<shell::mojom::ShellClient> 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::mojom::Shell* shell() const { return shell_.get(); } + ~ShellConnection() override; // Block the calling thread until the Initialize() method is called by the // shell. @@ -120,26 +115,25 @@ class ApplicationImpl : public Shell, public shell::mojom::Application { void QuitNow(); // Unbinds the Shell and Application connections. Can be used to re-bind the - // handles to another implementation of ApplicationImpl, for instance when + // handles to another implementation of ShellConnection, for instance when // running apptests. - void UnbindConnections( - InterfaceRequest<shell::mojom::Application>* application_request, - shell::mojom::ShellPtr* shell); + void UnbindConnections(InterfaceRequest<shell::mojom::ShellClient>* request, + shell::mojom::ShellPtr* shell); // We track the lifetime of incoming connection registries as it more // convenient for the client. ScopedVector<Connection> incoming_connections_; - ShellClient* client_; - Binding<shell::mojom::Application> binding_; + mojo::ShellClient* client_; + Binding<shell::mojom::ShellClient> binding_; shell::mojom::ShellPtr shell_; Closure termination_closure_; AppLifetimeHelper app_lifetime_helper_; bool quit_requested_; - base::WeakPtrFactory<ApplicationImpl> weak_factory_; + base::WeakPtrFactory<ShellConnection> weak_factory_; - MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); + MOJO_DISALLOW_COPY_AND_ASSIGN(ShellConnection); }; } // namespace mojo -#endif // MOJO_SHELL_PUBLIC_CPP_APPLICATION_IMPL_H_ +#endif // MOJO_SHELL_PUBLIC_CPP_SHELL_CONNECTION_H_ diff --git a/mojo/shell/public/interfaces/BUILD.gn b/mojo/shell/public/interfaces/BUILD.gn index 1aa7fc5..5565335 100644 --- a/mojo/shell/public/interfaces/BUILD.gn +++ b/mojo/shell/public/interfaces/BUILD.gn @@ -7,11 +7,11 @@ import("//mojo/public/tools/bindings/mojom.gni") # GYP version: mojo/mojo_base.gyp:mojo_application_bindings mojom("interfaces") { sources = [ - "application.mojom", "application_manager.mojom", "content_handler.mojom", "service_provider.mojom", "shell.mojom", + "shell_client.mojom", ] import_dirs = [ "//mojo/services" ] diff --git a/mojo/shell/public/interfaces/content_handler.mojom b/mojo/shell/public/interfaces/content_handler.mojom index 405238f..0dae8b9 100644 --- a/mojo/shell/public/interfaces/content_handler.mojom +++ b/mojo/shell/public/interfaces/content_handler.mojom @@ -4,7 +4,7 @@ module mojo.shell.mojom; -import "mojo/shell/public/interfaces/application.mojom"; +import "mojo/shell/public/interfaces/shell_client.mojom"; import "network/public/interfaces/url_loader.mojom"; // Interface implemented by content handlers. To avoid race conditions with @@ -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, mojo.URLResponse response) => (); + StartApplication(ShellClient& shell_client, mojo.URLResponse response) => (); }; diff --git a/mojo/shell/public/interfaces/application.mojom b/mojo/shell/public/interfaces/shell_client.mojom index b59b724..b438d82 100644 --- a/mojo/shell/public/interfaces/application.mojom +++ b/mojo/shell/public/interfaces/shell_client.mojom @@ -7,13 +7,14 @@ module mojo.shell.mojom; import "mojo/shell/public/interfaces/service_provider.mojom"; import "mojo/shell/public/interfaces/shell.mojom"; +// TODO(beng): rewrite these comments. // This is the primary interface implemented by every Mojo application. It // allows the application to receive its startup arguments from the shell, and // to be notified of events that occur during its execution. // // TODO(aa): It would be good to reorder the parameters once we have interface // versioning. -interface Application { +interface ShellClient { // Initializes the application with the specified arguments. This method is // guaranteed to be called before any other method is called, and will only be // called once. diff --git a/mojo/shell/runner/child/child_controller.mojom b/mojo/shell/runner/child/child_controller.mojom index 34c6dc9..f71c0d5 100644 --- a/mojo/shell/runner/child/child_controller.mojom +++ b/mojo/shell/runner/child/child_controller.mojom @@ -4,11 +4,11 @@ module mojo.shell.mojom; -import "mojo/shell/public/interfaces/application.mojom"; +import "mojo/shell/public/interfaces/shell_client.mojom"; interface ChildController { // Starts the app. - StartApp(Application& application_request) => (int32 result); + StartApp(ShellClient& request) => (int32 result); // Exits the child process now (with no cleanup), with the given exit code. ExitNow(int32 exit_code); diff --git a/mojo/shell/runner/child/runner_connection.cc b/mojo/shell/runner/child/runner_connection.cc index b8477ac..75b4648 100644 --- a/mojo/shell/runner/child/runner_connection.cc +++ b/mojo/shell/runner/child/runner_connection.cc @@ -72,7 +72,7 @@ class Blocker { }; using GotApplicationRequestCallback = - base::Callback<void(InterfaceRequest<mojom::Application>)>; + base::Callback<void(InterfaceRequest<mojom::ShellClient>)>; void OnCreateMessagePipe(ScopedMessagePipeHandle* result, Blocker::Unblocker unblocker, @@ -81,8 +81,8 @@ void OnCreateMessagePipe(ScopedMessagePipeHandle* result, unblocker.Unblock(base::Bind(&base::DoNothing)); } -void OnGotApplicationRequest(InterfaceRequest<mojom::Application>* out_request, - InterfaceRequest<mojom::Application> request) { +void OnGotApplicationRequest(InterfaceRequest<mojom::ShellClient>* out_request, + InterfaceRequest<mojom::ShellClient> request) { *out_request = std::move(request); } @@ -102,7 +102,7 @@ class RunnerConnectionImpl : public RunnerConnection { // Returns true if a connection to the runner has been established and // |request| has been modified, false if no connection was established. - bool WaitForApplicationRequest(InterfaceRequest<mojom::Application>* request, + bool WaitForApplicationRequest(InterfaceRequest<mojom::ShellClient>* request, ScopedMessagePipeHandle handle); ChildControllerImpl* controller() const { return controller_.get(); } @@ -173,14 +173,14 @@ class ChildControllerImpl : public mojom::ChildController { } // |mojom::ChildController| methods: - void StartApp(InterfaceRequest<mojom::Application> application_request, + void StartApp(InterfaceRequest<mojom::ShellClient> request, const StartAppCallback& on_app_complete) override { DCHECK(thread_checker_.CalledOnValidThread()); on_app_complete_ = on_app_complete; unblocker_.Unblock( base::Bind(&ChildControllerImpl::ReturnApplicationRequestOnMainThread, - callback_, base::Passed(&application_request))); + callback_, base::Passed(&request))); } void ExitNow(int32_t exit_code) override { @@ -199,8 +199,8 @@ class ChildControllerImpl : public mojom::ChildController { static void ReturnApplicationRequestOnMainThread( const GotApplicationRequestCallback& callback, - InterfaceRequest<mojom::Application> application_request) { - callback.Run(std::move(application_request)); + InterfaceRequest<mojom::ShellClient> request) { + callback.Run(std::move(request)); } base::ThreadChecker thread_checker_; @@ -215,7 +215,7 @@ class ChildControllerImpl : public mojom::ChildController { }; bool RunnerConnectionImpl::WaitForApplicationRequest( - InterfaceRequest<mojom::Application>* request, + InterfaceRequest<mojom::ShellClient>* request, ScopedMessagePipeHandle handle) { // If a valid message pipe to the runner was not provided, look for one on the // command line. @@ -255,7 +255,7 @@ RunnerConnection::~RunnerConnection() {} // static RunnerConnection* RunnerConnection::ConnectToRunner( - InterfaceRequest<mojom::Application>* request, + InterfaceRequest<mojom::ShellClient>* request, ScopedMessagePipeHandle handle) { RunnerConnectionImpl* connection = new RunnerConnectionImpl; if (!connection->WaitForApplicationRequest(request, std::move(handle))) { diff --git a/mojo/shell/runner/child/runner_connection.h b/mojo/shell/runner/child/runner_connection.h index 18f01b7..488b996 100644 --- a/mojo/shell/runner/child/runner_connection.h +++ b/mojo/shell/runner/child/runner_connection.h @@ -6,7 +6,7 @@ #define MOJO_SHELL_RUNNER_CHILD_RUNNER_CONNECTION_H_ #include "base/macros.h" -#include "mojo/shell/public/interfaces/application.mojom.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" namespace mojo { namespace shell { @@ -24,7 +24,7 @@ class RunnerConnection { // If a connection to the runner cannot be established, |request| will not be // modified and this function will return null. static RunnerConnection* ConnectToRunner( - InterfaceRequest<mojom::Application>* request, + InterfaceRequest<mojom::ShellClient>* request, ScopedMessagePipeHandle handle); protected: diff --git a/mojo/shell/runner/child/test_native_main.cc b/mojo/shell/runner/child/test_native_main.cc index 537b32b..8b4cbd8 100644 --- a/mojo/shell/runner/child/test_native_main.cc +++ b/mojo/shell/runner/child/test_native_main.cc @@ -13,8 +13,8 @@ #include "base/threading/thread.h" #include "build/build_config.h" #include "mojo/message_pump/message_pump_mojo.h" -#include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/shell_client.h" +#include "mojo/shell/public/cpp/shell_connection.h" #include "mojo/shell/runner/child/runner_connection.h" #include "mojo/shell/runner/init.h" #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" @@ -37,7 +37,7 @@ class ProcessDelegate : public mojo::embedder::ProcessDelegate { } // namespace -int TestNativeMain(mojo::ShellClient* application_delegate) { +int TestNativeMain(mojo::ShellClient* shell_client) { mojo::shell::WaitForDebuggerIfNecessary(); #if !defined(OFFICIAL_BUILD) @@ -60,13 +60,12 @@ int TestNativeMain(mojo::ShellClient* application_delegate) { mojo::embedder::ProcessType::NONE, &process_delegate, io_thread.task_runner().get(), mojo::embedder::ScopedPlatformHandle()); - mojo::ApplicationRequest application_request; + mojo::ShellClientRequest request; scoped_ptr<mojo::shell::RunnerConnection> connection( mojo::shell::RunnerConnection::ConnectToRunner( - &application_request, ScopedMessagePipeHandle())); + &request, ScopedMessagePipeHandle())); base::MessageLoop loop(mojo::common::MessagePumpMojo::Create()); - mojo::ApplicationImpl impl(application_delegate, - std::move(application_request)); + mojo::ShellConnection impl(shell_client, std::move(request)); loop.Run(); mojo::embedder::ShutdownIPCSupport(); diff --git a/mojo/shell/runner/child/test_native_main.h b/mojo/shell/runner/child/test_native_main.h index 600e814..3742bc5 100644 --- a/mojo/shell/runner/child/test_native_main.h +++ b/mojo/shell/runner/child/test_native_main.h @@ -9,7 +9,7 @@ namespace mojo { class ShellClient; namespace shell { -int TestNativeMain(mojo::ShellClient* application_delegate); +int TestNativeMain(mojo::ShellClient* shell_client); } // namespace shell } // namespace mojo diff --git a/mojo/shell/runner/host/child_process.cc b/mojo/shell/runner/host/child_process.cc index 1d9228c..0208b84 100644 --- a/mojo/shell/runner/host/child_process.cc +++ b/mojo/shell/runner/host/child_process.cc @@ -235,14 +235,14 @@ class ChildControllerImpl : public mojom::ChildController { } // |ChildController| methods: - void StartApp(InterfaceRequest<mojom::Application> application_request, + void StartApp(InterfaceRequest<mojom::ShellClient> request, const StartAppCallback& on_app_complete) override { DCHECK(thread_checker_.CalledOnValidThread()); on_app_complete_ = on_app_complete; unblocker_.Unblock(base::Bind(&ChildControllerImpl::StartAppOnMainThread, base::Unretained(app_library_), - base::Passed(&application_request))); + base::Passed(&request))); } void ExitNow(int32_t exit_code) override { @@ -258,8 +258,8 @@ class ChildControllerImpl : public mojom::ChildController { static void StartAppOnMainThread( base::NativeLibrary app_library, - InterfaceRequest<mojom::Application> application_request) { - if (!RunNativeApplication(app_library, std::move(application_request))) { + InterfaceRequest<mojom::ShellClient> request) { + if (!RunNativeApplication(app_library, std::move(request))) { LOG(ERROR) << "Failure to RunNativeApplication()"; } } diff --git a/mojo/shell/runner/host/child_process_host.cc b/mojo/shell/runner/host/child_process_host.cc index 4e9fa9f..9a5b439 100644 --- a/mojo/shell/runner/host/child_process_host.cc +++ b/mojo/shell/runner/host/child_process_host.cc @@ -113,7 +113,7 @@ void ChildProcessHost::Start(const ProcessReadyCallback& callback) { // while this boostrap is pending, resulting in OnMessagePipeCreated() never // being called. // - // A typical child process (i.e. one using ApplicationImpl to bind the other + // A typical child process (i.e. one using ShellConnection to bind the other // end of this pipe) may hang forever waiting for an Initialize() message // unless the pipe is closed. This in turn means that Join() could hang // waiting for the process to exit. Deadlock! @@ -156,13 +156,13 @@ int ChildProcessHost::Join() { } void ChildProcessHost::StartApp( - InterfaceRequest<mojom::Application> application_request, + InterfaceRequest<mojom::ShellClient> request, const mojom::ChildController::StartAppCallback& on_app_complete) { DCHECK(controller_); on_app_complete_ = on_app_complete; controller_->StartApp( - std::move(application_request), + std::move(request), base::Bind(&ChildProcessHost::AppCompleted, weak_factory_.GetWeakPtr())); } diff --git a/mojo/shell/runner/host/child_process_host.h b/mojo/shell/runner/host/child_process_host.h index 7472096..906a1a2 100644 --- a/mojo/shell/runner/host/child_process_host.h +++ b/mojo/shell/runner/host/child_process_host.h @@ -66,7 +66,7 @@ class ChildProcessHost { // See |mojom::ChildController|: void StartApp( - InterfaceRequest<mojom::Application> application_request, + InterfaceRequest<mojom::ShellClient> request, const mojom::ChildController::StartAppCallback& on_app_complete); void ExitNow(int32_t exit_code); diff --git a/mojo/shell/runner/host/in_process_native_runner.cc b/mojo/shell/runner/host/in_process_native_runner.cc index 1674cbf..56630d3 100644 --- a/mojo/shell/runner/host/in_process_native_runner.cc +++ b/mojo/shell/runner/host/in_process_native_runner.cc @@ -35,13 +35,13 @@ InProcessNativeRunner::~InProcessNativeRunner() { void InProcessNativeRunner::Start( const base::FilePath& app_path, bool start_sandboxed, - InterfaceRequest<mojom::Application> application_request, + InterfaceRequest<mojom::ShellClient> request, const base::Callback<void(base::ProcessId)>& pid_available_callback, const base::Closure& app_completed_callback) { app_path_ = app_path; - DCHECK(!application_request_.is_pending()); - application_request_ = std::move(application_request); + DCHECK(!request_.is_pending()); + request_ = std::move(request); DCHECK(app_completed_callback_runner_.is_null()); app_completed_callback_runner_ = base::Bind( @@ -56,7 +56,7 @@ void InProcessNativeRunner::Start( void InProcessNativeRunner::InitHost( ScopedHandle channel, - InterfaceRequest<mojom::Application> application_request) { + InterfaceRequest<mojom::ShellClient> request) { NOTREACHED(); // Can't host another process in this runner. } @@ -73,7 +73,7 @@ void InProcessNativeRunner::Run() { #if !(defined(COMPONENT_BUILD) && defined(OS_WIN)) CallLibraryEarlyInitialization(app_library); #endif - RunNativeApplication(app_library, std::move(application_request_)); + RunNativeApplication(app_library, std::move(request_)); app_completed_callback_runner_.Run(); app_completed_callback_runner_.Reset(); } diff --git a/mojo/shell/runner/host/in_process_native_runner.h b/mojo/shell/runner/host/in_process_native_runner.h index c167112..93216b2 100644 --- a/mojo/shell/runner/host/in_process_native_runner.h +++ b/mojo/shell/runner/host/in_process_native_runner.h @@ -33,19 +33,19 @@ class InProcessNativeRunner : public NativeRunner, void Start( const base::FilePath& app_path, bool start_sandboxed, - InterfaceRequest<mojom::Application> application_request, + InterfaceRequest<mojom::ShellClient> request, const base::Callback<void(base::ProcessId)>& pid_available_callback, const base::Closure& app_completed_callback) override; void InitHost( ScopedHandle channel, - InterfaceRequest<mojom::Application> application_request) override; + InterfaceRequest<mojom::ShellClient> request) override; private: // |base::DelegateSimpleThread::Delegate| method: void Run() override; base::FilePath app_path_; - InterfaceRequest<mojom::Application> application_request_; + InterfaceRequest<mojom::ShellClient> request_; base::Callback<bool(void)> app_completed_callback_runner_; base::ScopedNativeLibrary app_library_; diff --git a/mojo/shell/runner/host/native_application_support.cc b/mojo/shell/runner/host/native_application_support.cc index eeccef9..97288fa 100644 --- a/mojo/shell/runner/host/native_application_support.cc +++ b/mojo/shell/runner/host/native_application_support.cc @@ -54,7 +54,7 @@ base::NativeLibrary LoadNativeApplication(const base::FilePath& app_path) { bool RunNativeApplication( base::NativeLibrary app_library, - InterfaceRequest<mojom::Application> application_request) { + InterfaceRequest<mojom::ShellClient> request) { // Tolerate |app_library| being null, to make life easier for callers. if (!app_library) return false; @@ -120,7 +120,7 @@ bool RunNativeApplication( return false; } // |MojoMain()| takes ownership of the service handle. - MojoHandle handle = application_request.PassMessagePipe().release().value(); + MojoHandle handle = request.PassMessagePipe().release().value(); MojoResult result = main_function(handle); if (result != MOJO_RESULT_OK) { LOG(ERROR) << "MojoMain returned error (result: " << result << ")"; diff --git a/mojo/shell/runner/host/native_application_support.h b/mojo/shell/runner/host/native_application_support.h index 88daad3..2371f65 100644 --- a/mojo/shell/runner/host/native_application_support.h +++ b/mojo/shell/runner/host/native_application_support.h @@ -7,7 +7,7 @@ #include "base/native_library.h" #include "mojo/public/cpp/bindings/interface_request.h" -#include "mojo/shell/public/interfaces/application.mojom.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" namespace base { class FilePath; @@ -33,9 +33,8 @@ base::NativeLibrary LoadNativeApplication(const base::FilePath& app_path); // true if |MojoMain()| was called (even if it returns an error), and false // otherwise. // TODO(vtl): Maybe this should also have a |MojoResult| as an out parameter? -bool RunNativeApplication( - base::NativeLibrary app_library, - InterfaceRequest<mojom::Application> application_request); +bool RunNativeApplication(base::NativeLibrary app_library, + InterfaceRequest<mojom::ShellClient> request); } // namespace shell } // namespace mojo diff --git a/mojo/shell/runner/host/out_of_process_native_runner.cc b/mojo/shell/runner/host/out_of_process_native_runner.cc index 9b4ae03..b34f5ee 100644 --- a/mojo/shell/runner/host/out_of_process_native_runner.cc +++ b/mojo/shell/runner/host/out_of_process_native_runner.cc @@ -31,7 +31,7 @@ OutOfProcessNativeRunner::~OutOfProcessNativeRunner() { void OutOfProcessNativeRunner::Start( const base::FilePath& app_path, bool start_sandboxed, - InterfaceRequest<mojom::Application> application_request, + InterfaceRequest<mojom::ShellClient> request, const base::Callback<void(base::ProcessId)>& pid_available_callback, const base::Closure& app_completed_callback) { app_path_ = app_path; @@ -43,15 +43,15 @@ void OutOfProcessNativeRunner::Start( new ChildProcessHost(launch_process_runner_, start_sandboxed, app_path)); child_process_host_->Start(base::Bind( &OutOfProcessNativeRunner::OnProcessLaunched, base::Unretained(this), - base::Passed(&application_request), pid_available_callback)); + base::Passed(&request), pid_available_callback)); } void OutOfProcessNativeRunner::InitHost( ScopedHandle channel, - InterfaceRequest<mojom::Application> application_request) { + InterfaceRequest<mojom::ShellClient> request) { child_process_host_.reset(new ChildProcessHost(std::move(channel))); child_process_host_->StartApp( - std::move(application_request), + std::move(request), base::Bind(&OutOfProcessNativeRunner::AppCompleted, base::Unretained(this))); } @@ -69,12 +69,12 @@ void OutOfProcessNativeRunner::AppCompleted(int32_t result) { } void OutOfProcessNativeRunner::OnProcessLaunched( - InterfaceRequest<mojom::Application> application_request, + InterfaceRequest<mojom::ShellClient> request, const base::Callback<void(base::ProcessId)>& pid_available_callback, base::ProcessId pid) { DCHECK(child_process_host_); child_process_host_->StartApp( - std::move(application_request), + std::move(request), base::Bind(&OutOfProcessNativeRunner::AppCompleted, base::Unretained(this))); pid_available_callback.Run(pid); diff --git a/mojo/shell/runner/host/out_of_process_native_runner.h b/mojo/shell/runner/host/out_of_process_native_runner.h index 794c1f3..139dbdd 100644 --- a/mojo/shell/runner/host/out_of_process_native_runner.h +++ b/mojo/shell/runner/host/out_of_process_native_runner.h @@ -33,12 +33,12 @@ class OutOfProcessNativeRunner : public NativeRunner { void Start( const base::FilePath& app_path, bool start_sandboxed, - InterfaceRequest<mojom::Application> application_request, + InterfaceRequest<mojom::ShellClient> request, const base::Callback<void(base::ProcessId)>& pid_available_callback, const base::Closure& app_completed_callback) override; void InitHost( ScopedHandle channel, - InterfaceRequest<mojom::Application> application_request) override; + InterfaceRequest<mojom::ShellClient> request) override; private: // |ChildController::StartApp()| callback: @@ -46,7 +46,7 @@ class OutOfProcessNativeRunner : public NativeRunner { // Callback run when the child process has launched. void OnProcessLaunched( - InterfaceRequest<mojom::Application> application_request, + InterfaceRequest<mojom::ShellClient> request, const base::Callback<void(base::ProcessId)>& pid_available_callback, base::ProcessId pid); diff --git a/mojo/shell/shell_application_loader.cc b/mojo/shell/shell_application_loader.cc index e648295..7b55a8d 100644 --- a/mojo/shell/shell_application_loader.cc +++ b/mojo/shell/shell_application_loader.cc @@ -6,7 +6,7 @@ #include <utility> -#include "mojo/shell/public/cpp/application_impl.h" +#include "mojo/shell/public/cpp/shell_connection.h" #include "mojo/shell/shell_application_delegate.h" namespace mojo { @@ -18,10 +18,10 @@ ShellApplicationLoader::~ShellApplicationLoader() {} void ShellApplicationLoader::Load( const GURL& url, - InterfaceRequest<mojom::Application> application_request) { - DCHECK(application_request.is_pending()); - app_.reset(new ApplicationImpl(new ShellApplicationDelegate(manager_), - std::move(application_request))); + InterfaceRequest<mojom::ShellClient> request) { + DCHECK(request.is_pending()); + shell_connection_.reset(new ShellConnection( + new ShellApplicationDelegate(manager_), std::move(request))); } } // namespace shell diff --git a/mojo/shell/shell_application_loader.h b/mojo/shell/shell_application_loader.h index b00f08a..6c3258a 100644 --- a/mojo/shell/shell_application_loader.h +++ b/mojo/shell/shell_application_loader.h @@ -9,7 +9,7 @@ #include "mojo/shell/application_loader.h" namespace mojo { -class ApplicationImpl; +class ShellConnection; namespace shell { class ShellApplicationLoader : public ApplicationLoader { @@ -19,11 +19,10 @@ class ShellApplicationLoader : public ApplicationLoader { private: // Overridden from ApplicationLoader: - void Load( - const GURL& url, - InterfaceRequest<mojom::Application> application_request) override; + void Load(const GURL& url, + InterfaceRequest<mojom::ShellClient> request) override; - scoped_ptr<ApplicationImpl> app_; + scoped_ptr<ShellConnection> shell_connection_; ApplicationManager* manager_; diff --git a/mojo/shell/standalone/android/android_handler.cc b/mojo/shell/standalone/android/android_handler.cc index 9878824..cb284c5 100644 --- a/mojo/shell/standalone/android/android_handler.cc +++ b/mojo/shell/standalone/android/android_handler.cc @@ -41,8 +41,8 @@ void RunAndroidApplication(JNIEnv* env, jobject j_context, const base::FilePath& app_path, jint j_handle) { - InterfaceRequest<mojom::Application> application_request = - MakeRequest<mojom::Application>( + InterfaceRequest<mojom::ShellClient> request = + MakeRequest<mojom::ShellClient>( MakeScopedHandle(MessagePipeHandle(j_handle))); // Load the library, so that we can set the application context there if @@ -69,7 +69,7 @@ void RunAndroidApplication(JNIEnv* env, } // Run the application. - RunNativeApplication(app_library, std::move(application_request)); + RunNativeApplication(app_library, std::move(request)); // TODO(vtl): See note about unloading and thread-local destructors above // declaration of |LoadNativeApplication()|. base::UnloadNativeLibrary(app_library); @@ -133,7 +133,7 @@ AndroidHandler::AndroidHandler() : content_handler_factory_(this) {} AndroidHandler::~AndroidHandler() {} void AndroidHandler::RunApplication( - InterfaceRequest<mojom::Application> application_request, + InterfaceRequest<mojom::ShellClient> request, URLResponsePtr response) { JNIEnv* env = AttachCurrentThread(); RunAndroidApplicationFn run_android_application_fn = &RunAndroidApplication; @@ -149,7 +149,7 @@ void AndroidHandler::RunApplication( Java_AndroidHandler_bootstrapCachedApp( env, GetApplicationContext(), j_path_to_mojo.obj(), j_internal_app_path.obj(), - application_request.PassMessagePipe().release().value(), + request.PassMessagePipe().release().value(), reinterpret_cast<jlong>(run_android_application_fn)); return; } @@ -162,7 +162,7 @@ void AndroidHandler::RunApplication( common::BlockingCopyToFile(std::move(response->body), archive_path); Java_AndroidHandler_bootstrap( env, GetApplicationContext(), j_archive_path.obj(), - application_request.PassMessagePipe().release().value(), + request.PassMessagePipe().release().value(), reinterpret_cast<jlong>(run_android_application_fn)); } diff --git a/mojo/shell/standalone/android/android_handler.h b/mojo/shell/standalone/android/android_handler.h index ed8ad3e..70a246f 100644 --- a/mojo/shell/standalone/android/android_handler.h +++ b/mojo/shell/standalone/android/android_handler.h @@ -31,7 +31,7 @@ class AndroidHandler : public ShellClient, bool AcceptConnection(Connection* connection) override; // ContentHandlerFactory::Delegate: - void RunApplication(InterfaceRequest<mojom::Application> application_request, + void RunApplication(InterfaceRequest<mojom::ShellClient> request, URLResponsePtr response) override; ContentHandlerFactory content_handler_factory_; diff --git a/mojo/shell/standalone/android/android_handler_loader.cc b/mojo/shell/standalone/android/android_handler_loader.cc index 1c1bb5e..4ff4bab 100644 --- a/mojo/shell/standalone/android/android_handler_loader.cc +++ b/mojo/shell/standalone/android/android_handler_loader.cc @@ -13,12 +13,11 @@ AndroidHandlerLoader::AndroidHandlerLoader() {} AndroidHandlerLoader::~AndroidHandlerLoader() {} -void AndroidHandlerLoader::Load( - const GURL& url, - InterfaceRequest<mojom::Application> application_request) { - DCHECK(application_request.is_pending()); - application_.reset( - new ApplicationImpl(&android_handler_, std::move(application_request))); +void AndroidHandlerLoader::Load(const GURL& url, + InterfaceRequest<mojom::ShellClient> request) { + DCHECK(request.is_pending()); + shell_client_.reset( + new ShellConnection(&android_handler_, std::move(request))); } } // namespace shell diff --git a/mojo/shell/standalone/android/android_handler_loader.h b/mojo/shell/standalone/android/android_handler_loader.h index 18255d5..5aac6b1 100644 --- a/mojo/shell/standalone/android/android_handler_loader.h +++ b/mojo/shell/standalone/android/android_handler_loader.h @@ -9,7 +9,7 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "mojo/shell/application_loader.h" -#include "mojo/shell/public/cpp/application_impl.h" +#include "mojo/shell/public/cpp/shell_connection.h" #include "mojo/shell/standalone/android/android_handler.h" namespace mojo { @@ -23,10 +23,10 @@ class AndroidHandlerLoader : public ApplicationLoader { private: // ApplicationLoader overrides: void Load(const GURL& url, - InterfaceRequest<mojom::Application> application_request) override; + InterfaceRequest<mojom::ShellClient> request) override; AndroidHandler android_handler_; - scoped_ptr<ApplicationImpl> application_; + scoped_ptr<ShellConnection> shell_client_; DISALLOW_COPY_AND_ASSIGN(AndroidHandlerLoader); }; diff --git a/mojo/shell/standalone/android/background_application_loader.cc b/mojo/shell/standalone/android/background_application_loader.cc index 8bd3869..446ce42 100644 --- a/mojo/shell/standalone/android/background_application_loader.cc +++ b/mojo/shell/standalone/android/background_application_loader.cc @@ -29,12 +29,12 @@ BackgroundApplicationLoader::~BackgroundApplicationLoader() { void BackgroundApplicationLoader::Load( const GURL& url, - InterfaceRequest<mojom::Application> application_request) { - DCHECK(application_request.is_pending()); + InterfaceRequest<mojom::ShellClient> request) { + DCHECK(request.is_pending()); if (!thread_) { // TODO(tim): It'd be nice if we could just have each Load call // result in a new thread like DynamicService{Loader, Runner}. But some - // loaders are creating multiple ApplicationImpls (NetworkApplicationLoader) + // loaders are creating multiple ShellConnections (NetworkApplicationLoader) // sharing a delegate (etc). So we have to keep it single threaded, wait // for the thread to initialize, and post to the TaskRunner for subsequent // Load calls for now. @@ -47,8 +47,7 @@ void BackgroundApplicationLoader::Load( task_runner_->PostTask( FROM_HERE, base::Bind(&BackgroundApplicationLoader::LoadOnBackgroundThread, - base::Unretained(this), url, - base::Passed(&application_request))); + base::Unretained(this), url, base::Passed(&request))); } void BackgroundApplicationLoader::Run() { @@ -65,9 +64,9 @@ void BackgroundApplicationLoader::Run() { void BackgroundApplicationLoader::LoadOnBackgroundThread( const GURL& url, - InterfaceRequest<mojom::Application> application_request) { + InterfaceRequest<mojom::ShellClient> request) { DCHECK(task_runner_->RunsTasksOnCurrentThread()); - loader_->Load(url, std::move(application_request)); + loader_->Load(url, std::move(request)); } } // namespace shell diff --git a/mojo/shell/standalone/android/background_application_loader.h b/mojo/shell/standalone/android/background_application_loader.h index 203ce54..ed6f73c1 100644 --- a/mojo/shell/standalone/android/background_application_loader.h +++ b/mojo/shell/standalone/android/background_application_loader.h @@ -26,7 +26,7 @@ class BackgroundApplicationLoader // ApplicationLoader overrides: void Load(const GURL& url, - InterfaceRequest<mojom::Application> application_request) override; + InterfaceRequest<mojom::ShellClient> request) override; private: // |base::DelegateSimpleThread::Delegate| method: @@ -34,9 +34,8 @@ class BackgroundApplicationLoader // These functions are exected on the background thread. They call through // to |background_loader_| to do the actual loading. - void LoadOnBackgroundThread( - const GURL& url, - InterfaceRequest<mojom::Application> application_request); + void LoadOnBackgroundThread(const GURL& url, + InterfaceRequest<mojom::ShellClient> request); bool quit_on_shutdown_; scoped_ptr<ApplicationLoader> loader_; diff --git a/mojo/shell/standalone/android/background_application_loader_unittest.cc b/mojo/shell/standalone/android/background_application_loader_unittest.cc index b7c1712..fcea757 100644 --- a/mojo/shell/standalone/android/background_application_loader_unittest.cc +++ b/mojo/shell/standalone/android/background_application_loader_unittest.cc @@ -4,7 +4,7 @@ #include "mojo/shell/standalone/android/background_application_loader.h" -#include "mojo/shell/public/interfaces/application.mojom.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" #include "testing/gtest/include/gtest/gtest.h" namespace mojo { @@ -18,7 +18,7 @@ class DummyLoader : public ApplicationLoader { // ApplicationLoader overrides: void Load(const GURL& url, - InterfaceRequest<mojom::Application> application_request) override { + InterfaceRequest<mojom::ShellClient> request) override { if (simulate_app_quit_) base::MessageLoop::current()->QuitWhenIdle(); } diff --git a/mojo/shell/standalone/android/ui_application_loader_android.cc b/mojo/shell/standalone/android/ui_application_loader_android.cc index 39ebb8d..a848b2e 100644 --- a/mojo/shell/standalone/android/ui_application_loader_android.cc +++ b/mojo/shell/standalone/android/ui_application_loader_android.cc @@ -24,20 +24,19 @@ UIApplicationLoader::~UIApplicationLoader() { base::Unretained(this))); } -void UIApplicationLoader::Load( - const GURL& url, - InterfaceRequest<mojom::Application> application_request) { - DCHECK(application_request.is_pending()); +void UIApplicationLoader::Load(const GURL& url, + InterfaceRequest<mojom::ShellClient> request) { + DCHECK(request.is_pending()); ui_message_loop_->PostTask( FROM_HERE, base::Bind(&UIApplicationLoader::LoadOnUIThread, base::Unretained(this), - url, base::Passed(&application_request))); + url, base::Passed(&request))); } void UIApplicationLoader::LoadOnUIThread( const GURL& url, - InterfaceRequest<mojom::Application> application_request) { - loader_->Load(url, std::move(application_request)); + InterfaceRequest<mojom::ShellClient> request) { + loader_->Load(url, std::move(request)); } void UIApplicationLoader::ShutdownOnUIThread() { diff --git a/mojo/shell/standalone/android/ui_application_loader_android.h b/mojo/shell/standalone/android/ui_application_loader_android.h index 6a8c03e..5f9b5e1 100644 --- a/mojo/shell/standalone/android/ui_application_loader_android.h +++ b/mojo/shell/standalone/android/ui_application_loader_android.h @@ -29,7 +29,7 @@ class UIApplicationLoader : public ApplicationLoader { // ApplicationLoader overrides: void Load(const GURL& url, - InterfaceRequest<mojom::Application> application_request) override; + InterfaceRequest<mojom::ShellClient> request) override; private: class UILoader; @@ -39,7 +39,7 @@ class UIApplicationLoader : public ApplicationLoader { // TODO: having this code take a |manager| is fragile (as ApplicationManager // isn't thread safe). void LoadOnUIThread(const GURL& url, - InterfaceRequest<mojom::Application> application_request); + InterfaceRequest<mojom::ShellClient> request); void ShutdownOnUIThread(); scoped_ptr<ApplicationLoader> loader_; diff --git a/mojo/shell/static_application_loader.cc b/mojo/shell/static_application_loader.cc index 7b51027..a6920ff 100644 --- a/mojo/shell/static_application_loader.cc +++ b/mojo/shell/static_application_loader.cc @@ -15,7 +15,7 @@ #include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/shell/public/cpp/application_runner.h" #include "mojo/shell/public/cpp/shell_client.h" -#include "mojo/shell/public/interfaces/application.mojom.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" namespace mojo { namespace shell { @@ -25,7 +25,7 @@ namespace { class RunnerThread : public base::SimpleThread { public: RunnerThread(const GURL& url, - InterfaceRequest<mojom::Application> request, + InterfaceRequest<mojom::ShellClient> request, scoped_refptr<base::TaskRunner> exit_task_runner, const base::Closure& exit_callback, const StaticApplicationLoader::ApplicationFactory& factory) @@ -44,7 +44,7 @@ class RunnerThread : public base::SimpleThread { } private: - InterfaceRequest<mojom::Application> request_; + InterfaceRequest<mojom::ShellClient> request_; scoped_refptr<base::TaskRunner> exit_task_runner_; base::Closure exit_callback_; StaticApplicationLoader::ApplicationFactory factory_; @@ -72,7 +72,7 @@ StaticApplicationLoader::~StaticApplicationLoader() { void StaticApplicationLoader::Load( const GURL& url, - InterfaceRequest<mojom::Application> request) { + InterfaceRequest<mojom::ShellClient> request) { if (thread_) return; diff --git a/mojo/shell/static_application_loader.h b/mojo/shell/static_application_loader.h index 38b4a87..b3d55ba 100644 --- a/mojo/shell/static_application_loader.h +++ b/mojo/shell/static_application_loader.h @@ -44,7 +44,7 @@ class StaticApplicationLoader : public mojo::shell::ApplicationLoader { // mojo::shell::ApplicationLoader: void Load(const GURL& url, - InterfaceRequest<mojom::Application> request) override; + InterfaceRequest<mojom::ShellClient> request) override; private: void StopAppThread(); diff --git a/mojo/shell/test_package_manager.cc b/mojo/shell/test_package_manager.cc index 281925d..3947b52 100644 --- a/mojo/shell/test_package_manager.cc +++ b/mojo/shell/test_package_manager.cc @@ -22,7 +22,7 @@ uint32_t TestPackageManager::HandleWithContentHandler( const Identity& source, const GURL& target_url, const CapabilityFilter& target_filter, - InterfaceRequest<shell::mojom::Application>* application_request) { + InterfaceRequest<shell::mojom::ShellClient>* request) { return 0; } bool TestPackageManager::IsURLInCatalog(const std::string& url) const { diff --git a/mojo/shell/test_package_manager.h b/mojo/shell/test_package_manager.h index 0acb7bc..fc05576 100644 --- a/mojo/shell/test_package_manager.h +++ b/mojo/shell/test_package_manager.h @@ -30,7 +30,7 @@ class TestPackageManager : public PackageManager { const Identity& source, const GURL& target_url, const CapabilityFilter& target_filter, - InterfaceRequest<shell::mojom::Application>* application_request) + InterfaceRequest<shell::mojom::ShellClient>* request) override; bool IsURLInCatalog(const std::string& url) const override; std::string GetApplicationName(const std::string& url) const override; diff --git a/ui/views/mus/platform_test_helper_mus.cc b/ui/views/mus/platform_test_helper_mus.cc index d1df50a..f34206e 100644 --- a/ui/views/mus/platform_test_helper_mus.cc +++ b/ui/views/mus/platform_test_helper_mus.cc @@ -6,8 +6,8 @@ #include "base/command_line.h" #include "mojo/shell/background/background_shell.h" -#include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/shell_client.h" +#include "mojo/shell/public/cpp/shell_connection.h" #include "ui/views/mus/window_manager_connection.h" #include "url/gurl.h" @@ -32,25 +32,25 @@ class PlatformTestHelperMus : public PlatformTestHelper { background_shell_.reset(new mojo::shell::BackgroundShell); background_shell_->Init(); shell_client_.reset(new DefaultShellClient); - app_.reset(new mojo::ApplicationImpl( + shell_connection_.reset(new mojo::ShellConnection( shell_client_.get(), - background_shell_->CreateApplication(GURL("mojo://test-app")))); - app_->WaitForInitialize(); + background_shell_->CreateShellClientRequest(GURL("mojo://test-app")))); + shell_connection_->WaitForInitialize(); // ui/views/mus requires a WindowManager running, for now use the desktop // one. - app_->Connect("mojo:desktop_wm"); - WindowManagerConnection::Create(app_.get()); + shell_connection_->Connect("mojo:desktop_wm"); + WindowManagerConnection::Create(shell_connection_.get()); } ~PlatformTestHelperMus() override { WindowManagerConnection::Reset(); // |app_| has a reference to us, destroy it while we are still valid. - app_.reset(); + shell_connection_.reset(); } private: scoped_ptr<mojo::shell::BackgroundShell> background_shell_; - scoped_ptr<mojo::ApplicationImpl> app_; + scoped_ptr<mojo::ShellConnection> shell_connection_; scoped_ptr<DefaultShellClient> shell_client_; DISALLOW_COPY_AND_ASSIGN(PlatformTestHelperMus); |