diff options
162 files changed, 688 insertions, 798 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 48a5e9a..4bb50bd 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -153,7 +153,7 @@ #include "content/public/common/web_preferences.h" #include "device/devices_app/usb/public/interfaces/device_manager.mojom.h" #include "gin/v8_initializer.h" -#include "mojo/shell/public/cpp/application_delegate.h" +#include "mojo/shell/public/cpp/shell_client.h" #include "net/base/mime_util.h" #include "net/cookies/canonical_cookie.h" #include "net/cookies/cookie_options.h" diff --git a/components/clipboard/clipboard_application_delegate.cc b/components/clipboard/clipboard_application_delegate.cc index 9f3cde5..fe148c7 100644 --- a/components/clipboard/clipboard_application_delegate.cc +++ b/components/clipboard/clipboard_application_delegate.cc @@ -7,7 +7,7 @@ #include <utility> #include "components/clipboard/clipboard_standalone_impl.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" namespace clipboard { @@ -22,13 +22,13 @@ void ClipboardApplicationDelegate::Initialize(mojo::Shell* shell, } bool ClipboardApplicationDelegate::AcceptConnection( - mojo::ApplicationConnection* connection) { + mojo::Connection* connection) { connection->AddService(this); return true; } void ClipboardApplicationDelegate::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<mojo::Clipboard> request) { // TODO(erg): Write native implementations of the clipboard. For now, we // just build a clipboard which doesn't interact with the system. diff --git a/components/clipboard/clipboard_application_delegate.h b/components/clipboard/clipboard_application_delegate.h index 18b8b04..1184f9b 100644 --- a/components/clipboard/clipboard_application_delegate.h +++ b/components/clipboard/clipboard_application_delegate.h @@ -8,30 +8,25 @@ #include "base/macros.h" #include "components/clipboard/public/interfaces/clipboard.mojom.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory.h" - -namespace mojo { -class ApplicationConnection; -} +#include "mojo/shell/public/cpp/shell_client.h" namespace clipboard { class ClipboardApplicationDelegate - : public mojo::ApplicationDelegate, + : public mojo::ShellClient, public mojo::InterfaceFactory<mojo::Clipboard> { public: ClipboardApplicationDelegate(); ~ClipboardApplicationDelegate() override; - // mojo::ApplicationDelegate implementation. + // mojo::ShellClient implementation. void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; // mojo::InterfaceFactory<mojo::Clipboard> implementation. - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<mojo::Clipboard> request) override; private: diff --git a/components/devtools_service/devtools_service_delegate.cc b/components/devtools_service/devtools_service_delegate.cc index 5382703..d4384cc 100644 --- a/components/devtools_service/devtools_service_delegate.cc +++ b/components/devtools_service/devtools_service_delegate.cc @@ -10,7 +10,7 @@ #include "components/devtools_service/devtools_registry_impl.h" #include "components/devtools_service/devtools_service.h" #include "mojo/common/url_type_converters.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" #include "url/gurl.h" @@ -38,8 +38,7 @@ void DevToolsServiceDelegate::Initialize(mojo::Shell* shell, service_.reset(new DevToolsService(shell)); } -bool DevToolsServiceDelegate::AcceptConnection( - mojo::ApplicationConnection* connection) { +bool DevToolsServiceDelegate::AcceptConnection(mojo::Connection* connection) { connection->AddService<DevToolsRegistry>(this); // DevToolsCoordinator is a privileged interface and only allowed for the @@ -54,13 +53,13 @@ void DevToolsServiceDelegate::Quit() { } void DevToolsServiceDelegate::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<DevToolsRegistry> request) { service_->registry()->BindToRegistryRequest(std::move(request)); } void DevToolsServiceDelegate::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<DevToolsCoordinator> request) { service_->BindToCoordinatorRequest(std::move(request)); } diff --git a/components/devtools_service/devtools_service_delegate.h b/components/devtools_service/devtools_service_delegate.h index a500a7f..5ae52f9 100644 --- a/components/devtools_service/devtools_service_delegate.h +++ b/components/devtools_service/devtools_service_delegate.h @@ -8,15 +8,15 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "components/devtools_service/public/interfaces/devtools_service.mojom.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace devtools_service { class DevToolsService; class DevToolsServiceDelegate - : public mojo::ApplicationDelegate, + : public mojo::ShellClient, public mojo::InterfaceFactory<DevToolsRegistry>, public mojo::InterfaceFactory<DevToolsCoordinator> { public: @@ -24,19 +24,18 @@ class DevToolsServiceDelegate ~DevToolsServiceDelegate() override; private: - // mojo::ApplicationDelegate implementation. + // mojo::Connection implementation. void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; void Quit() override; // mojo::InterfaceFactory<DevToolsRegistry> implementation. - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<DevToolsRegistry> request) override; // mojo::InterfaceFactory<DevToolsCoordinator> implementation. - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<DevToolsCoordinator> request) override; scoped_ptr<DevToolsService> service_; diff --git a/components/filesystem/file_system_app.cc b/components/filesystem/file_system_app.cc index 855ece4..ec3887b 100644 --- a/components/filesystem/file_system_app.cc +++ b/components/filesystem/file_system_app.cc @@ -8,7 +8,7 @@ #include "base/bind.h" #include "base/logging.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" namespace filesystem { @@ -23,8 +23,7 @@ void FileSystemApp::Initialize(mojo::Shell* shell, const std::string& url, tracing_.Initialize(shell, url); } -bool FileSystemApp::AcceptConnection( - mojo::ApplicationConnection* connection) { +bool FileSystemApp::AcceptConnection(mojo::Connection* connection) { connection->AddService<FileSystem>(this); return true; } @@ -57,7 +56,7 @@ bool FileSystemApp::ShellConnectionLost() { } // |InterfaceFactory<Files>| implementation: -void FileSystemApp::Create(mojo::ApplicationConnection* connection, +void FileSystemApp::Create(mojo::Connection* connection, mojo::InterfaceRequest<FileSystem> request) { new FileSystemImpl(this, connection, std::move(request)); } diff --git a/components/filesystem/file_system_app.h b/components/filesystem/file_system_app.h index b8ef41c..44da313 100644 --- a/components/filesystem/file_system_app.h +++ b/components/filesystem/file_system_app.h @@ -10,8 +10,8 @@ #include "components/filesystem/file_system_impl.h" #include "components/filesystem/public/interfaces/file_system.mojom.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace mojo { class Shell; @@ -19,7 +19,7 @@ class Shell; namespace filesystem { -class FileSystemApp : public mojo::ApplicationDelegate, +class FileSystemApp : public mojo::ShellClient, public mojo::InterfaceFactory<FileSystem> { public: FileSystemApp(); @@ -34,15 +34,14 @@ class FileSystemApp : public mojo::ApplicationDelegate, // that we can QuitNow() once the last DirectoryImpl has closed itself. void OnDirectoryConnectionError(DirectoryImpl* directory); - // |ApplicationDelegate| override: + // |mojo::ShellClient| override: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; bool ShellConnectionLost() override; // |InterfaceFactory<Files>| implementation: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<FileSystem> request) override; // Use a vector to work around map not letting us use FileSystemClientPtr as diff --git a/components/filesystem/file_system_impl.cc b/components/filesystem/file_system_impl.cc index 88de84c..785e690 100644 --- a/components/filesystem/file_system_impl.cc +++ b/components/filesystem/file_system_impl.cc @@ -17,7 +17,7 @@ #include "build/build_config.h" #include "components/filesystem/directory_impl.h" #include "components/filesystem/file_system_app.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "url/gurl.h" #if defined(OS_WIN) @@ -46,7 +46,7 @@ const char kUserDataDir[] = "user-data-dir"; } // namespace filesystem FileSystemImpl::FileSystemImpl(FileSystemApp* app, - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<FileSystem> request) : app_(app), remote_application_url_(connection->GetRemoteApplicationURL()), diff --git a/components/filesystem/file_system_impl.h b/components/filesystem/file_system_impl.h index 2cda44d..c3fae13 100644 --- a/components/filesystem/file_system_impl.h +++ b/components/filesystem/file_system_impl.h @@ -15,7 +15,7 @@ class FilePath; } namespace mojo { -class ApplicationConnection; +class Connection; } namespace filesystem { @@ -24,7 +24,7 @@ class FileSystemApp; class FileSystemImpl : public FileSystem { public: FileSystemImpl(FileSystemApp* app, - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<FileSystem> request); ~FileSystemImpl() override; diff --git a/components/font_service/font_service_app.cc b/components/font_service/font_service_app.cc index 7618296..8636c7c 100644 --- a/components/font_service/font_service_app.cc +++ b/components/font_service/font_service_app.cc @@ -9,7 +9,7 @@ #include "base/files/file.h" #include "base/files/file_path.h" #include "mojo/platform_handle/platform_handle_functions.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" static_assert(static_cast<uint32_t>(SkTypeface::kNormal) == static_cast<uint32_t>(font_service::TypefaceStyle::NORMAL), @@ -63,13 +63,12 @@ void FontServiceApp::Initialize(mojo::Shell* shell, const std::string& url, tracing_.Initialize(shell, url); } -bool FontServiceApp::AcceptConnection( - mojo::ApplicationConnection* connection) { +bool FontServiceApp::AcceptConnection(mojo::Connection* connection) { connection->AddService(this); return true; } -void FontServiceApp::Create(mojo::ApplicationConnection* connection, +void FontServiceApp::Create(mojo::Connection* connection, mojo::InterfaceRequest<FontService> request) { bindings_.AddBinding(this, std::move(request)); } diff --git a/components/font_service/font_service_app.h b/components/font_service/font_service_app.h index 914eb08..6c2aeea 100644 --- a/components/font_service/font_service_app.h +++ b/components/font_service/font_service_app.h @@ -11,13 +11,13 @@ #include "components/font_service/public/interfaces/font_service.mojom.h" #include "mojo/common/weak_binding_set.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_client.h" #include "skia/ext/skia_utils_base.h" namespace font_service { -class FontServiceApp : public mojo::ApplicationDelegate, +class FontServiceApp : public mojo::ShellClient, public mojo::InterfaceFactory<FontService>, public FontService { public: @@ -25,14 +25,13 @@ class FontServiceApp : public mojo::ApplicationDelegate, ~FontServiceApp() override; private: - // ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; // mojo::InterfaceFactory<FontService>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<FontService> request) override; // FontService: diff --git a/components/html_viewer/ax_provider_apptest.cc b/components/html_viewer/ax_provider_apptest.cc index d53d271..0506418 100644 --- a/components/html_viewer/ax_provider_apptest.cc +++ b/components/html_viewer/ax_provider_apptest.cc @@ -82,7 +82,7 @@ TEST_F(AXProviderTest, HelloWorld) { ASSERT_TRUE(server.Start()); // Connect to the URL through the mojo:html_viewer content handler. - scoped_ptr<ApplicationConnection> connection = + scoped_ptr<Connection> connection = shell()->ConnectToApplication(server.GetURL("/test.html").spec()); // Embed the html_viewer in a Window. diff --git a/components/html_viewer/blink_platform_impl.cc b/components/html_viewer/blink_platform_impl.cc index 1f27e86..3380fb5 100644 --- a/components/html_viewer/blink_platform_impl.cc +++ b/components/html_viewer/blink_platform_impl.cc @@ -78,7 +78,7 @@ BlinkPlatformImpl::BlinkPlatformImpl( main_thread_task_runner_(renderer_scheduler->DefaultTaskRunner()), main_thread_(renderer_scheduler->CreateMainThread()) { if (shell) { - scoped_ptr<mojo::ApplicationConnection> connection = + scoped_ptr<mojo::Connection> connection = shell->ConnectToApplication("mojo:network_service"); connection->ConnectToService(&web_socket_factory_); connection->ConnectToService(&url_loader_factory_); diff --git a/components/html_viewer/html_document.cc b/components/html_viewer/html_document.cc index fca5dd4..fdb4efd 100644 --- a/components/html_viewer/html_document.cc +++ b/components/html_viewer/html_document.cc @@ -28,7 +28,6 @@ #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/connect.h" #include "mojo/shell/public/interfaces/shell.mojom.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" #include "ui/gfx/geometry/dip_util.h" @@ -95,7 +94,7 @@ void HTMLDocument::TransferableState::Move(TransferableState* other) { } HTMLDocument::HTMLDocument(mojo::Shell* html_document_shell, - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::URLResponsePtr response, GlobalState* global_state, const DeleteCallback& delete_callback, @@ -271,7 +270,7 @@ void HTMLDocument::OnFrameDestroyed() { delete this; } -void HTMLDocument::Create(mojo::ApplicationConnection* connection, +void HTMLDocument::Create(mojo::Connection* connection, mojo::InterfaceRequest<AxProvider> request) { if (!did_finish_local_frame_load_) { // Cache AxProvider interface requests until the document finishes loading. @@ -284,7 +283,7 @@ void HTMLDocument::Create(mojo::ApplicationConnection* connection, } } -void HTMLDocument::Create(mojo::ApplicationConnection* connection, +void HTMLDocument::Create(mojo::Connection* connection, mojo::InterfaceRequest<TestHTMLViewer> request) { CHECK(IsTestInterfaceEnabled()); if (!did_finish_local_frame_load_) { @@ -298,7 +297,7 @@ void HTMLDocument::Create(mojo::ApplicationConnection* connection, } void HTMLDocument::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<web_view::mojom::FrameClient> request) { if (frame_) { DVLOG(1) << "Request for FrameClient after one already vended."; @@ -308,7 +307,7 @@ void HTMLDocument::Create( } void HTMLDocument::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<devtools_service::DevToolsAgent> request) { if (frame_) { if (frame_->devtools_agent()) @@ -319,7 +318,7 @@ void HTMLDocument::Create( } void HTMLDocument::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) { DCHECK(!transferable_state_.window_tree_delegate_impl); transferable_state_.window_tree_delegate_impl.reset( diff --git a/components/html_viewer/html_document.h b/components/html_viewer/html_document.h index 453d2df..b24f2b3 100644 --- a/components/html_viewer/html_document.h +++ b/components/html_viewer/html_document.h @@ -64,7 +64,7 @@ class HTMLDocument // |connection| the specific connection triggering this new instance. // |setup| is used to obtain init type state (such as resources). HTMLDocument(mojo::Shell* html_document_shell, - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::URLResponsePtr response, GlobalState* setup, const DeleteCallback& delete_callback, @@ -119,31 +119,31 @@ class HTMLDocument void OnFrameDestroyed() override; // mojo::InterfaceFactory<mojo::AxProvider>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<mojo::AxProvider> request) override; // mojo::InterfaceFactory<web_view::mojom::FrameClient>: void Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<web_view::mojom::FrameClient> request) override; // mojo::InterfaceFactory<TestHTMLViewer>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<TestHTMLViewer> request) override; // mojo::InterfaceFactory<devtools_service::DevToolsAgent>: void Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<devtools_service::DevToolsAgent> request) override; // mojo::InterfaceFactory<mus::WindowTreeClient>: void Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) override; scoped_ptr<mojo::AppRefCount> app_refcount_; mojo::Shell* html_document_shell_; - mojo::ApplicationConnection* connection_; + mojo::Connection* connection_; // HTMLDocument owns these pointers; binding requests after document load. std::set<AxProviderImpl*> ax_providers_; diff --git a/components/html_viewer/html_document_application_delegate.cc b/components/html_viewer/html_document_application_delegate.cc index 5da6b38..e1208d2c 100644 --- a/components/html_viewer/html_document_application_delegate.cc +++ b/components/html_viewer/html_document_application_delegate.cc @@ -10,9 +10,7 @@ #include "base/macros.h" #include "components/html_viewer/global_state.h" #include "components/html_viewer/html_document.h" -#include "mojo/shell/public/cpp/application_connection.h" -#include "mojo/shell/public/cpp/application_delegate.h" -#include "mojo/shell/public/cpp/connect.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace html_viewer { @@ -25,7 +23,7 @@ class HTMLDocumentApplicationDelegate::ServiceConnectorQueue ServiceConnectorQueue() {} ~ServiceConnectorQueue() override {} - void PushRequestsTo(mojo::ApplicationConnection* connection) { + void PushRequestsTo(mojo::Connection* connection) { ScopedVector<Request> requests; requests_.swap(requests); for (Request* request : requests) { @@ -41,7 +39,7 @@ class HTMLDocumentApplicationDelegate::ServiceConnectorQueue }; // mojo::ServiceConnector: - void ConnectToService(mojo::ApplicationConnection* application_connection, + void ConnectToService(mojo::Connection* connection, const std::string& interface_name, mojo::ScopedMessagePipeHandle handle) override { scoped_ptr<Request> request(new Request); @@ -85,14 +83,14 @@ HTMLDocumentApplicationDelegate::~HTMLDocumentApplicationDelegate() { } // Callback from the quit closure. We key off this rather than -// ApplicationDelegate::Quit() as we don't want to shut down the messageloop +// mojo::ShellClient::Quit() as we don't want to shut down the messageloop // when we quit (the messageloop is shared among multiple // HTMLDocumentApplicationDelegates). void HTMLDocumentApplicationDelegate::OnTerminate() { delete this; } -// ApplicationDelegate; +// mojo::ShellClient; void HTMLDocumentApplicationDelegate::Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) { @@ -100,7 +98,7 @@ void HTMLDocumentApplicationDelegate::Initialize(mojo::Shell* shell, } bool HTMLDocumentApplicationDelegate::AcceptConnection( - mojo::ApplicationConnection* connection) { + mojo::Connection* connection) { if (initial_response_) { OnResponseReceived(nullptr, mojo::URLLoaderPtr(), connection, nullptr, std::move(initial_response_)); @@ -157,7 +155,7 @@ void HTMLDocumentApplicationDelegate::OnHTMLDocumentDeleted2( void HTMLDocumentApplicationDelegate::OnResponseReceived( scoped_ptr<mojo::AppRefCount> app_refcount, mojo::URLLoaderPtr loader, - mojo::ApplicationConnection* connection, + mojo::Connection* connection, scoped_ptr<ServiceConnectorQueue> connector_queue, mojo::URLResponsePtr response) { // HTMLDocument is destroyed when the hosting view is destroyed, or diff --git a/components/html_viewer/html_document_application_delegate.h b/components/html_viewer/html_document_application_delegate.h index b28dde5..8870021 100644 --- a/components/html_viewer/html_document_application_delegate.h +++ b/components/html_viewer/html_document_application_delegate.h @@ -13,17 +13,17 @@ #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_delegate.h" #include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace html_viewer { class GlobalState; class HTMLDocument; -// ApplicationDelegate created by the content handler for a specific url. -class HTMLDocumentApplicationDelegate : public mojo::ApplicationDelegate, +// mojo::ShellClient created by the content handler for a specific url. +class HTMLDocumentApplicationDelegate : public mojo::ShellClient, public HTMLFactory { public: HTMLDocumentApplicationDelegate( @@ -42,21 +42,20 @@ class HTMLDocumentApplicationDelegate : public mojo::ApplicationDelegate, ~HTMLDocumentApplicationDelegate() override; // Callback from the quit closure. We key off this rather than - // ApplicationDelegate::Quit() as we don't want to shut down the messageloop + // ShellClient::Quit() as we don't want to shut down the messageloop // when we quit (the messageloop is shared among multiple // HTMLDocumentApplicationDelegates). void OnTerminate(); - // ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; void OnHTMLDocumentDeleted2(HTMLDocument* document); void OnResponseReceived(scoped_ptr<mojo::AppRefCount> app_refcount, mojo::URLLoaderPtr loader, - mojo::ApplicationConnection* connection, + mojo::Connection* connection, scoped_ptr<ServiceConnectorQueue> connector_queue, mojo::URLResponsePtr response); diff --git a/components/html_viewer/html_frame_apptest.cc b/components/html_viewer/html_frame_apptest.cc index e9bbaf4..a52baad 100644 --- a/components/html_viewer/html_frame_apptest.cc +++ b/components/html_viewer/html_frame_apptest.cc @@ -52,12 +52,11 @@ void OnGotContentHandlerForRoot(bool* got_callback) { ignore_result(WindowServerTestBase::QuitRunLoop()); } -mojo::ApplicationConnection* ApplicationConnectionForFrame(Frame* frame) { - return static_cast<FrameConnection*>(frame->user_data()) - ->application_connection(); +mojo::Connection* ConnectionForFrame(Frame* frame) { + return static_cast<FrameConnection*>(frame->user_data())->connection(); } -std::string GetFrameText(ApplicationConnection* connection) { +std::string GetFrameText(Connection* connection) { html_viewer::TestHTMLViewerPtr test_html_viewer; connection->ConnectToService(&test_html_viewer); std::string result; @@ -71,7 +70,7 @@ std::string GetFrameText(ApplicationConnection* connection) { return result; } -scoped_ptr<base::Value> ExecuteScript(ApplicationConnection* connection, +scoped_ptr<base::Value> ExecuteScript(Connection* connection, const std::string& script) { html_viewer::TestHTMLViewerPtr test_html_viewer; connection->ConnectToService(&test_html_viewer); @@ -182,8 +181,7 @@ class HTMLFrameTest : public WindowServerTestBase { ADD_FAILURE() << "unable to establish root connection"; return nullptr; } - const std::string frame_text = - GetFrameText(root_connection->application_connection()); + const std::string frame_text = GetFrameText(root_connection->connection()); if (frame_text != "child2") { ADD_FAILURE() << "unexpected text " << frame_text; return nullptr; @@ -195,7 +193,7 @@ class HTMLFrameTest : public WindowServerTestBase { Frame* CreateEmptyChildFrame(Frame* parent) { const size_t initial_frame_count = parent->children().size(); // Dynamically add a new frame. - ExecuteScript(ApplicationConnectionForFrame(parent), + ExecuteScript(ConnectionForFrame(parent), AddPortToString(kAddFrameWithEmptyPageScript)); frame_tree_delegate_->WaitForChildFrameCount(parent, @@ -278,7 +276,7 @@ TEST_F(HTMLFrameTest, MAYBE_PageWithSingleFrame) { ASSERT_TRUE(root_connection); ASSERT_EQ("Page with single frame", - GetFrameText(root_connection->application_connection())); + GetFrameText(root_connection->connection())); ASSERT_NO_FATAL_FAILURE( frame_tree_delegate_->WaitForChildFrameCount(frame_tree_->root(), 1u)); @@ -290,7 +288,7 @@ TEST_F(HTMLFrameTest, MAYBE_PageWithSingleFrame) { ASSERT_EQ("child", GetFrameText(static_cast<FrameConnection*>(child_frame->user_data()) - ->application_connection())); + ->connection())); } // Creates two frames. The parent navigates the child frame by way of changing @@ -316,14 +314,14 @@ TEST_F(HTMLFrameTest, MAYBE_ChangeLocationOfChildFrame) { ASSERT_EQ("child", GetFrameText(static_cast<FrameConnection*>(child_frame->user_data()) - ->application_connection())); + ->connection())); // Change the location and wait for the navigation to occur. const char kNavigateFrame[] = "window.frames[0].location = " "'http://127.0.0.1:%u/empty_page2.html'"; frame_tree_delegate_->ClearGotNavigate(child_frame); - ExecuteScript(ApplicationConnectionForFrame(frame_tree_->root()), + ExecuteScript(ConnectionForFrame(frame_tree_->root()), AddPortToString(kNavigateFrame)); ASSERT_TRUE(frame_tree_delegate_->WaitForFrameNavigation(child_frame)); @@ -334,15 +332,14 @@ TEST_F(HTMLFrameTest, MAYBE_ChangeLocationOfChildFrame) { ASSERT_TRUE(child_frame->user_data()); ASSERT_EQ("child2", GetFrameText(static_cast<FrameConnection*>(child_frame->user_data()) - ->application_connection())); + ->connection())); } TEST_F(HTMLFrameTest, DynamicallyAddFrameAndVerifyParent) { Frame* child_frame = LoadEmptyPageAndCreateFrame(); ASSERT_TRUE(child_frame); - mojo::ApplicationConnection* child_frame_connection = - ApplicationConnectionForFrame(child_frame); + mojo::Connection* child_frame_connection = ConnectionForFrame(child_frame); ASSERT_EQ("child", GetFrameText(child_frame_connection)); // The child's parent should not be itself: @@ -363,8 +360,7 @@ TEST_F(HTMLFrameTest, DynamicallyAddFrameAndSeeNameChange) { Frame* child_frame = LoadEmptyPageAndCreateFrame(); ASSERT_TRUE(child_frame); - mojo::ApplicationConnection* child_frame_connection = - ApplicationConnectionForFrame(child_frame); + mojo::Connection* child_frame_connection = ConnectionForFrame(child_frame); // Change the name of the child's window. ExecuteScript(child_frame_connection, "window.name = 'new_child';"); @@ -377,7 +373,7 @@ TEST_F(HTMLFrameTest, DynamicallyAddFrameAndSeeNameChange) { do { find_window_result.clear(); scoped_ptr<base::Value> script_value( - ExecuteScript(ApplicationConnectionForFrame(frame_tree_->root()), + ExecuteScript(ConnectionForFrame(frame_tree_->root()), "window.frames['new_child'] != null ? 'found frame' : " "'unable to find frame';")); if (script_value->IsType(base::Value::TYPE_LIST)) { @@ -414,7 +410,7 @@ TEST_F(HTMLFrameTest, FrameTreeOfThreeLevels) { do { child_child_frame_count.clear(); scoped_ptr<base::Value> script_value( - ExecuteScript(ApplicationConnectionForFrame(frame_tree_->root()), + ExecuteScript(ConnectionForFrame(frame_tree_->root()), kGetChildChildFrameCount)); if (script_value->IsType(base::Value::TYPE_LIST)) { base::ListValue* script_value_as_list; @@ -431,11 +427,11 @@ TEST_F(HTMLFrameTest, FrameTreeOfThreeLevels) { // Remove the child's child and make sure the root doesn't see it anymore. const char kRemoveLastIFrame[] = "document.body.removeChild(document.body.lastChild);"; - ExecuteScript(ApplicationConnectionForFrame(child_frame), kRemoveLastIFrame); + ExecuteScript(ConnectionForFrame(child_frame), kRemoveLastIFrame); do { child_child_frame_count.clear(); scoped_ptr<base::Value> script_value( - ExecuteScript(ApplicationConnectionForFrame(frame_tree_->root()), + ExecuteScript(ConnectionForFrame(frame_tree_->root()), kGetChildChildFrameCount)); if (script_value->IsType(base::Value::TYPE_LIST)) { base::ListValue* script_value_as_list; @@ -455,8 +451,7 @@ TEST_F(HTMLFrameTest, PostMessage) { Frame* child_frame = LoadEmptyPageAndCreateFrame(); ASSERT_TRUE(child_frame); - mojo::ApplicationConnection* child_frame_connection = - ApplicationConnectionForFrame(child_frame); + mojo::Connection* child_frame_connection = ConnectionForFrame(child_frame); ASSERT_EQ("child", GetFrameText(child_frame_connection)); // Register an event handler in the child frame. @@ -471,7 +466,7 @@ TEST_F(HTMLFrameTest, PostMessage) { // Post a message from the parent to the child. const char kPostMessageFromParent[] = "window.frames[0].postMessage('hello from parent', '*');"; - ExecuteScript(ApplicationConnectionForFrame(frame_tree_->root()), + ExecuteScript(ConnectionForFrame(frame_tree_->root()), kPostMessageFromParent); // Wait for the child frame to see the message. diff --git a/components/html_viewer/html_viewer.cc b/components/html_viewer/html_viewer.cc index d475038..62fcf52 100644 --- a/components/html_viewer/html_viewer.cc +++ b/components/html_viewer/html_viewer.cc @@ -8,7 +8,7 @@ #include "components/html_viewer/content_handler_impl.h" #include "components/html_viewer/global_state.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" namespace html_viewer { @@ -24,14 +24,13 @@ void HTMLViewer::Initialize(mojo::Shell* shell, const std::string& url, global_state_.reset(new GlobalState(shell, url)); } -bool HTMLViewer::AcceptConnection( - mojo::ApplicationConnection* connection) { +bool HTMLViewer::AcceptConnection(mojo::Connection* connection) { connection->AddService(this); return true; } void HTMLViewer::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<mojo::shell::mojom::ContentHandler> request) { new ContentHandlerImpl(global_state_.get(), shell_, std::move(request)); } diff --git a/components/html_viewer/html_viewer.h b/components/html_viewer/html_viewer.h index 83597c1..d712316 100644 --- a/components/html_viewer/html_viewer.h +++ b/components/html_viewer/html_viewer.h @@ -7,8 +7,8 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_client.h" #include "mojo/shell/public/interfaces/content_handler.mojom.h" namespace html_viewer { @@ -16,7 +16,7 @@ namespace html_viewer { class GlobalState; class HTMLViewer - : public mojo::ApplicationDelegate, + : public mojo::ShellClient, public mojo::InterfaceFactory<mojo::shell::mojom::ContentHandler> { public: HTMLViewer(); @@ -26,17 +26,17 @@ class HTMLViewer GlobalState* global_state() const { return global_state_.get(); } mojo::Shell* shell() const { return shell_; } - // Overridden from ApplicationDelegate: + // Overridden from mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; private: - // Overridden from ApplicationDelegate: + // Overridden from mojo::ShellClient: bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + mojo::Connection* connection) override; // Overridden from InterfaceFactory<shell::mojom::ContentHandler> - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<mojo::shell::mojom::ContentHandler> request) override; diff --git a/components/html_viewer/layout_test_html_viewer.cc b/components/html_viewer/layout_test_html_viewer.cc index 115539e..db7fb60 100644 --- a/components/html_viewer/layout_test_html_viewer.cc +++ b/components/html_viewer/layout_test_html_viewer.cc @@ -45,7 +45,7 @@ void LayoutTestHTMLViewer::TestFinished() { } void LayoutTestHTMLViewer::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<mojo::shell::mojom::ContentHandler> request) { new LayoutTestContentHandlerImpl(global_state(), shell(), std::move(request), test_interfaces_.get(), &test_delegate_); diff --git a/components/html_viewer/layout_test_html_viewer.h b/components/html_viewer/layout_test_html_viewer.h index 861e8c5..701a415 100644 --- a/components/html_viewer/layout_test_html_viewer.h +++ b/components/html_viewer/layout_test_html_viewer.h @@ -24,12 +24,12 @@ class LayoutTestHTMLViewer : public HTMLViewer { private: void TestFinished(); - // Overridden from ApplicationDelegate: + // Overridden from mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; // Overridden from InterfaceFactory<shell::mojom::ContentHandler> - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<mojo::shell::mojom::ContentHandler> request) override; diff --git a/components/html_viewer/stats_collection_controller.cc b/components/html_viewer/stats_collection_controller.cc index e6cdf5c..508f616 100644 --- a/components/html_viewer/stats_collection_controller.cc +++ b/components/html_viewer/stats_collection_controller.cc @@ -82,7 +82,7 @@ tracing::StartupPerformanceDataCollectorPtr StatsCollectionController::Install( v8::Context::Scope context_scope(context); - scoped_ptr<mojo::ApplicationConnection> connection = + scoped_ptr<mojo::Connection> connection = shell->ConnectToApplication("mojo:tracing"); if (!connection) return nullptr; diff --git a/components/mus/mus_app.cc b/components/mus/mus_app.cc index b7ffa4d..cd7a786 100644 --- a/components/mus/mus_app.cc +++ b/components/mus/mus_app.cc @@ -16,7 +16,7 @@ #include "components/mus/ws/window_tree_impl.h" #include "mojo/public/c/system/main.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" #include "ui/events/event_switches.h" #include "ui/events/platform/platform_event_source.h" @@ -30,7 +30,7 @@ #include "ui/ozone/public/ozone_platform.h" #endif -using mojo::ApplicationConnection; +using mojo::Connection; using mojo::InterfaceRequest; using mus::mojom::WindowTreeHostFactory; using mus::mojom::Gpu; @@ -90,8 +90,7 @@ void MandolineUIServicesApp::Initialize(mojo::Shell* shell, tracing_.Initialize(shell, url); } -bool MandolineUIServicesApp::AcceptConnection( - ApplicationConnection* connection) { +bool MandolineUIServicesApp::AcceptConnection(Connection* connection) { connection->AddService<Gpu>(this); connection->AddService<mojom::DisplayManager>(this); connection->AddService<mojom::WindowManagerFactoryService>(this); @@ -130,7 +129,7 @@ MandolineUIServicesApp::CreateClientConnectionForEmbedAtWindow( } void MandolineUIServicesApp::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<mojom::DisplayManager> request) { if (!connection_manager_->has_tree_host_connections()) { scoped_ptr<PendingRequest> pending_request(new PendingRequest); @@ -143,13 +142,13 @@ void MandolineUIServicesApp::Create( } void MandolineUIServicesApp::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<mojom::WindowManagerFactoryService> request) { connection_manager_->CreateWindowManagerFactoryService(std::move(request)); } void MandolineUIServicesApp::Create( - ApplicationConnection* connection, + Connection* connection, InterfaceRequest<mojom::WindowTreeFactory> request) { if (!connection_manager_->has_tree_host_connections()) { scoped_ptr<PendingRequest> pending_request(new PendingRequest); @@ -167,12 +166,12 @@ void MandolineUIServicesApp::Create( } void MandolineUIServicesApp::Create( - ApplicationConnection* connection, + Connection* connection, InterfaceRequest<WindowTreeHostFactory> request) { factory_bindings_.AddBinding(this, std::move(request)); } -void MandolineUIServicesApp::Create(mojo::ApplicationConnection* connection, +void MandolineUIServicesApp::Create(mojo::Connection* connection, mojo::InterfaceRequest<Gpu> request) { DCHECK(gpu_state_); new GpuImpl(std::move(request), gpu_state_); diff --git a/components/mus/mus_app.h b/components/mus/mus_app.h index 920e668..61f9632 100644 --- a/components/mus/mus_app.h +++ b/components/mus/mus_app.h @@ -19,9 +19,8 @@ #include "components/mus/ws/connection_manager_delegate.h" #include "mojo/common/weak_binding_set.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/app_lifetime_helper.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace mojo { class Shell; @@ -43,7 +42,7 @@ class WindowTreeFactory; } class MandolineUIServicesApp - : public mojo::ApplicationDelegate, + : public mojo::ShellClient, public ws::ConnectionManagerDelegate, public mojo::InterfaceFactory<mojom::DisplayManager>, public mojo::InterfaceFactory<mojom::WindowManagerFactoryService>, @@ -60,11 +59,10 @@ class MandolineUIServicesApp // has been established. struct PendingRequest; - // ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; // ConnectionManagerDelegate: void OnFirstRootConnectionCreated() override; @@ -77,26 +75,26 @@ class MandolineUIServicesApp mojom::WindowTreeClientPtr client) override; // mojo::InterfaceFactory<mojom::DisplayManager> implementation. - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<mojom::DisplayManager> request) override; // mojo::InterfaceFactory<mojom::WindowManagerFactoryService> implementation. - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<mojom::WindowManagerFactoryService> request) override; // mojo::InterfaceFactory<mojom::WindowTreeFactory>: void Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<mojom::WindowTreeFactory> request) override; // mojo::InterfaceFactory<mojom::WindowTreeHostFactory>: void Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<mojom::WindowTreeHostFactory> request) override; // mojo::InterfaceFactory<mojom::Gpu> implementation. - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<mojom::Gpu> request) override; // mojom::WindowTreeHostFactory implementation. diff --git a/components/mus/public/cpp/tests/window_server_test_base.cc b/components/mus/public/cpp/tests/window_server_test_base.cc index 636e4f7..678fc55 100644 --- a/components/mus/public/cpp/tests/window_server_test_base.cc +++ b/components/mus/public/cpp/tests/window_server_test_base.cc @@ -71,12 +71,11 @@ void WindowServerTestBase::SetUp() { std::swap(window_manager_, most_recent_connection_); } -mojo::ApplicationDelegate* WindowServerTestBase::GetApplicationDelegate() { +mojo::ShellClient* WindowServerTestBase::GetShellClient() { return this; } -bool WindowServerTestBase::AcceptConnection( - mojo::ApplicationConnection* connection) { +bool WindowServerTestBase::AcceptConnection(mojo::Connection* connection) { connection->AddService<mojom::WindowTreeClient>(this); return true; } @@ -124,7 +123,7 @@ void WindowServerTestBase::OnAccelerator(uint32_t id, mojom::EventPtr event) { } void WindowServerTestBase::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<mojom::WindowTreeClient> request) { WindowTreeConnection::Create( this, std::move(request), diff --git a/components/mus/public/cpp/tests/window_server_test_base.h b/components/mus/public/cpp/tests/window_server_test_base.h index 03e557f..e1c3c74 100644 --- a/components/mus/public/cpp/tests/window_server_test_base.h +++ b/components/mus/public/cpp/tests/window_server_test_base.h @@ -11,7 +11,6 @@ #include "components/mus/public/cpp/window_tree_delegate.h" #include "components/mus/public/interfaces/window_tree.mojom.h" #include "components/mus/public/interfaces/window_tree_host.mojom.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/application_test_base.h" #include "mojo/shell/public/cpp/interface_factory.h" @@ -23,7 +22,7 @@ namespace mus { // established as part of SetUp(). class WindowServerTestBase : public mojo::test::ApplicationTestBase, - public mojo::ApplicationDelegate, + public mojo::ShellClient, public WindowTreeDelegate, public WindowManagerDelegate, public mojo::InterfaceFactory<mojom::WindowTreeClient> { @@ -64,11 +63,10 @@ class WindowServerTestBase void SetUp() override; // test::ApplicationTestBase: - mojo::ApplicationDelegate* GetApplicationDelegate() override; + mojo::ShellClient* GetShellClient() override; - // ApplicationDelegate: - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + // mojo::ShellClient: + bool AcceptConnection(mojo::Connection* connection) override; // WindowTreeDelegate: void OnEmbed(Window* root) override; @@ -85,7 +83,7 @@ class WindowServerTestBase void OnAccelerator(uint32_t id, mojom::EventPtr event) override; // InterfaceFactory<WindowTreeClient>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<mojom::WindowTreeClient> request) override; // Used to receive the most recent window tree connection loaded by an embed diff --git a/components/mus/ws/connection_manager.cc b/components/mus/ws/connection_manager.cc index ae7fe82..d40f428 100644 --- a/components/mus/ws/connection_manager.cc +++ b/components/mus/ws/connection_manager.cc @@ -17,7 +17,7 @@ #include "mojo/converters/geometry/geometry_type_converters.h" #include "mojo/converters/input_events/input_events_type_converters.h" #include "mojo/converters/surfaces/surfaces_type_converters.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "ui/gfx/geometry/size_conversions.h" namespace mus { diff --git a/components/mus/ws/display_manager.cc b/components/mus/ws/display_manager.cc index dea7a83..8968293 100644 --- a/components/mus/ws/display_manager.cc +++ b/components/mus/ws/display_manager.cc @@ -27,7 +27,7 @@ #include "mojo/converters/surfaces/surfaces_type_converters.h" #include "mojo/converters/surfaces/surfaces_utils.h" #include "mojo/converters/transform/transform_type_converters.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" #include "third_party/skia/include/core/SkXfermode.h" #include "ui/base/cursor/cursor_loader.h" diff --git a/components/mus/ws/window_manager_client_apptest.cc b/components/mus/ws/window_manager_client_apptest.cc index 2312d72..34d42fb 100644 --- a/components/mus/ws/window_manager_client_apptest.cc +++ b/components/mus/ws/window_manager_client_apptest.cc @@ -16,7 +16,6 @@ #include "components/mus/public/cpp/window_tree_connection_observer.h" #include "components/mus/public/cpp/window_tree_delegate.h" #include "mojo/converters/geometry/geometry_type_converters.h" -#include "mojo/shell/public/cpp/application_connection.h" #include "mojo/shell/public/cpp/application_test_base.h" #include "ui/gfx/geometry/rect.h" #include "ui/mojo/geometry/geometry_util.h" diff --git a/components/mus/ws/window_tree_apptest.cc b/components/mus/ws/window_tree_apptest.cc index 8237e58..cb43c7e 100644 --- a/components/mus/ws/window_tree_apptest.cc +++ b/components/mus/ws/window_tree_apptest.cc @@ -16,15 +16,14 @@ #include "components/mus/ws/test_change_tracker.h" #include "mojo/converters/geometry/geometry_type_converters.h" #include "mojo/public/cpp/bindings/associated_binding.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/application_test_base.h" -using mojo::ApplicationConnection; -using mojo::ApplicationDelegate; using mojo::Array; using mojo::Callback; +using mojo::Connection; using mojo::InterfaceRequest; using mojo::RectPtr; +using mojo::ShellClient; using mojo::String; using mus::mojom::ErrorCode; using mus::mojom::EventPtr; @@ -449,7 +448,7 @@ class WindowTreeClientFactory private: // InterfaceFactory<WindowTreeClient>: - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<WindowTreeClient> request) override { client_impl_.reset(new TestWindowTreeClientImpl()); client_impl_->Bind(std::move(request)); @@ -466,7 +465,7 @@ class WindowTreeClientFactory } // namespace class WindowTreeAppTest : public mojo::test::ApplicationTestBase, - public ApplicationDelegate { + public mojo::ShellClient { public: WindowTreeAppTest() : connection_id_1_(0), connection_id_2_(0), root_window_id_(0) {} @@ -561,7 +560,7 @@ class WindowTreeAppTest : public mojo::test::ApplicationTestBase, } // ApplicationTestBase: - ApplicationDelegate* GetApplicationDelegate() override { return this; } + mojo::ShellClient* GetShellClient() override { return this; } void SetUp() override { ApplicationTestBase::SetUp(); client_factory_.reset(new WindowTreeClientFactory()); @@ -592,8 +591,8 @@ class WindowTreeAppTest : public mojo::test::ApplicationTestBase, changes1()->clear(); } - // ApplicationDelegate implementation. - bool AcceptConnection(ApplicationConnection* connection) override { + // mojo::ShellClient implementation. + bool AcceptConnection(Connection* connection) override { connection->AddService(client_factory_.get()); return true; } diff --git a/components/pdf_viewer/pdf_viewer.cc b/components/pdf_viewer/pdf_viewer.cc index ed5de3b..1fa2984 100644 --- a/components/pdf_viewer/pdf_viewer.cc +++ b/components/pdf_viewer/pdf_viewer.cc @@ -25,14 +25,12 @@ #include "mojo/common/data_pipe_utils.h" #include "mojo/public/c/system/main.h" #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_connection.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/application_runner.h" -#include "mojo/shell/public/cpp/connect.h" #include "mojo/shell/public/cpp/interface_factory_impl.h" -#include "mojo/shell/public/cpp/service_provider_impl.h" +#include "mojo/shell/public/cpp/shell_client.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" @@ -55,7 +53,7 @@ class PDFView : public mus::WindowTreeDelegate, using DeleteCallback = base::Callback<void(PDFView*)>; PDFView(mojo::Shell* shell, - mojo::ApplicationConnection* connection, + mojo::Connection* connection, FPDF_DOCUMENT doc, const DeleteCallback& delete_callback) : app_ref_(shell->CreateAppRefCount()), @@ -216,7 +214,7 @@ class PDFView : public mus::WindowTreeDelegate, // mojo::InterfaceFactory<web_view::mojom::FrameClient>: void Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<web_view::mojom::FrameClient> request) override { frame_client_binding_.Bind(std::move(request)); } @@ -240,7 +238,7 @@ class PDFView : public mus::WindowTreeDelegate, // Responsible for managing all the views for displaying a PDF document. class PDFViewerApplicationDelegate - : public mojo::ApplicationDelegate, + : public mojo::ShellClient, public mojo::InterfaceFactory<mus::mojom::WindowTreeClient> { public: PDFViewerApplicationDelegate( @@ -277,7 +275,7 @@ class PDFViewerApplicationDelegate } // Callback from the quit closure. We key off this rather than - // ApplicationDelegate::Quit() as we don't want to shut down the messageloop + // ShellClient::Quit() as we don't want to shut down the messageloop // when we quit (the messageloop is shared among multiple PDFViews). void OnTerminate() { delete this; } @@ -287,16 +285,15 @@ class PDFViewerApplicationDelegate pdf_views_.erase(std::find(pdf_views_.begin(), pdf_views_.end(), pdf_view)); } - // ApplicationDelegate: - bool AcceptConnection( - mojo::ApplicationConnection* connection) override { + // mojo::ShellClient: + bool AcceptConnection(mojo::Connection* connection) override { connection->AddService<mus::mojom::WindowTreeClient>(this); return true; } // mojo::InterfaceFactory<mus::mojom::WindowTreeClient>: void Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) override { PDFView* pdf_view = new PDFView( &app_, connection, doc_, @@ -341,7 +338,7 @@ class ContentHandlerImpl : public mojo::shell::mojom::ContentHandler { }; class PDFViewer - : public mojo::ApplicationDelegate, + : public mojo::ShellClient, public mojo::InterfaceFactory<mojo::shell::mojom::ContentHandler> { public: PDFViewer() { @@ -352,20 +349,19 @@ class PDFViewer ~PDFViewer() override { FPDF_DestroyLibrary(); } private: - // ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override { tracing_.Initialize(shell, url); } - bool AcceptConnection( - mojo::ApplicationConnection* connection) override { + bool AcceptConnection(mojo::Connection* connection) override { connection->AddService(this); return true; } // InterfaceFactory<ContentHandler>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<mojo::shell::mojom::ContentHandler> request) override { new ContentHandlerImpl(std::move(request)); diff --git a/components/resource_provider/resource_provider_app.cc b/components/resource_provider/resource_provider_app.cc index 79e034d..e62438e 100644 --- a/components/resource_provider/resource_provider_app.cc +++ b/components/resource_provider/resource_provider_app.cc @@ -8,7 +8,7 @@ #include "components/resource_provider/file_utils.h" #include "components/resource_provider/resource_provider_impl.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "url/gurl.h" namespace resource_provider { @@ -26,8 +26,7 @@ void ResourceProviderApp::Initialize(mojo::Shell* shell, const std::string& url, tracing_.Initialize(shell, url); } -bool ResourceProviderApp::AcceptConnection( - mojo::ApplicationConnection* connection) { +bool ResourceProviderApp::AcceptConnection(mojo::Connection* connection) { const base::FilePath app_path( GetPathForApplicationUrl(connection->GetRemoteApplicationURL())); if (app_path.empty()) @@ -38,7 +37,7 @@ bool ResourceProviderApp::AcceptConnection( } void ResourceProviderApp::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<ResourceProvider> request) { const base::FilePath app_path( GetPathForApplicationUrl(connection->GetRemoteApplicationURL())); diff --git a/components/resource_provider/resource_provider_app.h b/components/resource_provider/resource_provider_app.h index 8831e6c..2d1dd4d 100644 --- a/components/resource_provider/resource_provider_app.h +++ b/components/resource_provider/resource_provider_app.h @@ -12,8 +12,8 @@ #include "mojo/common/weak_binding_set.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace mojo { class Shell; @@ -21,21 +21,20 @@ class Shell; namespace resource_provider { -class ResourceProviderApp : public mojo::ApplicationDelegate, +class ResourceProviderApp : public mojo::ShellClient, public mojo::InterfaceFactory<ResourceProvider> { public: explicit ResourceProviderApp(const std::string& resource_provider_app_url); ~ResourceProviderApp() override; private: - // ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; // mojo::InterfaceFactory<ResourceProvider>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<ResourceProvider> request) override; mojo::TracingImpl tracing_; diff --git a/components/resource_provider/resource_provider_apptest.cc b/components/resource_provider/resource_provider_apptest.cc index 83e77e3..cc5bfe1 100644 --- a/components/resource_provider/resource_provider_apptest.cc +++ b/components/resource_provider/resource_provider_apptest.cc @@ -15,9 +15,7 @@ #include "mojo/platform_handle/platform_handle_functions.h" #include "mojo/public/cpp/bindings/array.h" #include "mojo/public/cpp/system/macros.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/application_test_base.h" -#include "mojo/shell/public/cpp/service_provider_impl.h" namespace resource_provider { namespace { diff --git a/components/web_view/frame_apptest.cc b/components/web_view/frame_apptest.cc index be5d636..cd79680 100644 --- a/components/web_view/frame_apptest.cc +++ b/components/web_view/frame_apptest.cc @@ -26,10 +26,7 @@ #include "components/web_view/frame_tree_delegate.h" #include "components/web_view/frame_user_data.h" #include "components/web_view/test_frame_tree_delegate.h" -#include "mojo/shell/public/cpp/application_connection.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/application_test_base.h" -#include "mojo/shell/public/cpp/service_provider_impl.h" using mus::Window; using mus::WindowTreeConnection; @@ -286,7 +283,7 @@ class WindowAndFrame : public mus::WindowTreeDelegate { }; class FrameTest : public mojo::test::ApplicationTestBase, - public mojo::ApplicationDelegate, + public mojo::ShellClient, public mus::WindowTreeDelegate, public mojo::InterfaceFactory<mus::mojom::WindowTreeClient>, public mojo::InterfaceFactory<mojom::FrameClient> { @@ -353,11 +350,10 @@ class FrameTest : public mojo::test::ApplicationTestBase, private: // ApplicationTestBase: - ApplicationDelegate* GetApplicationDelegate() override { return this; } + mojo::ShellClient* GetShellClient() override { return this; } - // ApplicationDelegate implementation. - bool AcceptConnection( - mojo::ApplicationConnection* connection) override { + // mojo::ShellClient implementation. + bool AcceptConnection(mojo::Connection* connection) override { connection->AddService<mus::mojom::WindowTreeClient>(this); connection->AddService<mojom::FrameClient>(this); return true; @@ -406,7 +402,7 @@ class FrameTest : public mojo::test::ApplicationTestBase, // Overridden from mojo::InterfaceFactory<mus::mojom::WindowTreeClient>: void Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) override { if (window_and_frame_) { mus::WindowTreeConnection::Create( @@ -420,7 +416,7 @@ class FrameTest : public mojo::test::ApplicationTestBase, } // Overridden from mojo::InterfaceFactory<mojom::FrameClient>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<mojom::FrameClient> request) override { ASSERT_TRUE(window_and_frame_); window_and_frame_->Bind(std::move(request)); diff --git a/components/web_view/frame_connection.cc b/components/web_view/frame_connection.cc index c3417d7..a6049b7 100644 --- a/components/web_view/frame_connection.cc +++ b/components/web_view/frame_connection.cc @@ -22,7 +22,7 @@ #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h" #include "mojo/services/network/public/interfaces/web_socket_factory.mojom.h" #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" #if defined(OS_LINUX) && !defined(OS_ANDROID) @@ -50,7 +50,7 @@ void OnGotContentHandlerForFrame( } // namespace -FrameConnection::FrameConnection() : application_connection_(nullptr) { +FrameConnection::FrameConnection() : connection_(nullptr) { } FrameConnection::~FrameConnection() { @@ -72,7 +72,7 @@ void FrameConnection::CreateConnectionForCanNavigateFrame( void FrameConnection::Init(mojo::Shell* shell, mojo::URLRequestPtr request, const base::Closure& on_got_id_callback) { - DCHECK(!application_connection_); + DCHECK(!connection_); mojo::shell::mojom::CapabilityFilterPtr filter( mojo::shell::mojom::CapabilityFilter::New()); @@ -119,22 +119,22 @@ void FrameConnection::Init(mojo::Shell* shell, mojo::Shell::ConnectParams params(std::move(request)); params.set_filter(std::move(filter)); - application_connection_ = shell->ConnectToApplication(¶ms); - application_connection_->ConnectToService(&frame_client_); - application_connection_->AddRemoteIDCallback(on_got_id_callback); + connection_ = shell->ConnectToApplication(¶ms); + connection_->ConnectToService(&frame_client_); + connection_->AddRemoteIDCallback(on_got_id_callback); } mus::mojom::WindowTreeClientPtr FrameConnection::GetWindowTreeClient() { - DCHECK(application_connection_); + DCHECK(connection_); mus::mojom::WindowTreeClientPtr window_tree_client; - application_connection_->ConnectToService(&window_tree_client); + connection_->ConnectToService(&window_tree_client); return window_tree_client; } uint32_t FrameConnection::GetContentHandlerID() const { uint32_t content_handler_id = mojo::shell::mojom::Shell::kInvalidApplicationID; - if (!application_connection_->GetRemoteContentHandlerID(&content_handler_id)) + if (!connection_->GetRemoteContentHandlerID(&content_handler_id)) NOTREACHED(); return content_handler_id; } diff --git a/components/web_view/frame_connection.h b/components/web_view/frame_connection.h index cd29edd..a1488af 100644 --- a/components/web_view/frame_connection.h +++ b/components/web_view/frame_connection.h @@ -17,7 +17,7 @@ #include "mojo/services/network/public/interfaces/url_loader.mojom.h" namespace mojo { -class ApplicationConnection; +class Connection; class Shell; } @@ -51,9 +51,7 @@ class FrameConnection : public FrameUserData { mojom::FrameClient* frame_client() { return frame_client_.get(); } - mojo::ApplicationConnection* application_connection() { - return application_connection_.get(); - } + mojo::Connection* connection() { return connection_.get(); } // Asks the remote application for a WindowTreeClient. mus::mojom::WindowTreeClientPtr GetWindowTreeClient(); @@ -65,7 +63,7 @@ class FrameConnection : public FrameUserData { private: mojom::FrameClientPtr frame_client_; - scoped_ptr<mojo::ApplicationConnection> application_connection_; + scoped_ptr<mojo::Connection> connection_; DISALLOW_COPY_AND_ASSIGN(FrameConnection); }; diff --git a/components/web_view/test_runner/test_runner_application_delegate.cc b/components/web_view/test_runner/test_runner_application_delegate.cc index fc0f698..e470cc3 100644 --- a/components/web_view/test_runner/test_runner_application_delegate.cc +++ b/components/web_view/test_runner/test_runner_application_delegate.cc @@ -24,7 +24,7 @@ #include "components/test_runner/blink_test_platform_support.h" #include "mojo/converters/geometry/geometry_type_converters.h" #include "mojo/services/network/public/interfaces/url_loader.mojom.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/size.h" @@ -61,7 +61,7 @@ void TestRunnerApplicationDelegate::Terminate() { } //////////////////////////////////////////////////////////////////////////////// -// mojo::ApplicationDelegate implementation: +// mojo::ShellClient implementation: void TestRunnerApplicationDelegate::Initialize(mojo::Shell* shell, const std::string& url, @@ -74,7 +74,7 @@ void TestRunnerApplicationDelegate::Initialize(mojo::Shell* shell, } bool TestRunnerApplicationDelegate::AcceptConnection( - mojo::ApplicationConnection* connection) { + mojo::Connection* connection) { connection->AddService<web_view::LayoutTestRunner>(this); return true; } @@ -158,7 +158,7 @@ void TestRunnerApplicationDelegate::TestFinished() { // mojo::InterfaceFactory<LayoutTestRunner> implementation: void TestRunnerApplicationDelegate::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<web_view::LayoutTestRunner> request) { layout_test_runner_.AddBinding(this, std::move(request)); } diff --git a/components/web_view/test_runner/test_runner_application_delegate.h b/components/web_view/test_runner/test_runner_application_delegate.h index 4fd2c80..fc1d3d9 100644 --- a/components/web_view/test_runner/test_runner_application_delegate.h +++ b/components/web_view/test_runner/test_runner_application_delegate.h @@ -17,15 +17,15 @@ #include "components/web_view/public/interfaces/web_view.mojom.h" #include "components/web_view/test_runner/public/interfaces/layout_test_runner.mojom.h" #include "mojo/common/weak_binding_set.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_client.h" class GURL; namespace web_view { class TestRunnerApplicationDelegate - : public mojo::ApplicationDelegate, + : public mojo::ShellClient, public mus::WindowTreeDelegate, public mojom::WebViewClient, public LayoutTestRunner, @@ -38,11 +38,10 @@ class TestRunnerApplicationDelegate void LaunchURL(const GURL& test_url); void Terminate(); - // mojo::ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; // mus::WindowTreeDelegate: void OnEmbed(mus::Window* root) override; @@ -65,7 +64,7 @@ class TestRunnerApplicationDelegate void TestFinished() override; // mojo::InterfaceFactory<LayoutTestRunner>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<LayoutTestRunner> request) override; mojo::Shell* shell_; diff --git a/components/web_view/web_view_application_delegate.cc b/components/web_view/web_view_application_delegate.cc index f264fe5..1c9c5c7 100644 --- a/components/web_view/web_view_application_delegate.cc +++ b/components/web_view/web_view_application_delegate.cc @@ -7,7 +7,7 @@ #include <utility> #include "components/web_view/web_view_impl.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" namespace web_view { @@ -22,7 +22,7 @@ void WebViewApplicationDelegate::Initialize(mojo::Shell* shell, } bool WebViewApplicationDelegate::AcceptConnection( - mojo::ApplicationConnection* connection) { + mojo::Connection* connection) { connection->AddService<mojom::WebViewFactory>(this); return true; } @@ -34,7 +34,7 @@ void WebViewApplicationDelegate::CreateWebView( } void WebViewApplicationDelegate::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<mojom::WebViewFactory> request) { factory_bindings_.AddBinding(this, std::move(request)); } diff --git a/components/web_view/web_view_application_delegate.h b/components/web_view/web_view_application_delegate.h index 38b46e6..943f5e8 100644 --- a/components/web_view/web_view_application_delegate.h +++ b/components/web_view/web_view_application_delegate.h @@ -9,13 +9,13 @@ #include "components/web_view/public/interfaces/web_view.mojom.h" #include "mojo/common/weak_binding_set.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace web_view { class WebViewApplicationDelegate - : public mojo::ApplicationDelegate, + : public mojo::ShellClient, public mojom::WebViewFactory, public mojo::InterfaceFactory<mojom::WebViewFactory> { public: @@ -23,18 +23,17 @@ class WebViewApplicationDelegate ~WebViewApplicationDelegate() override; private: - // Overridden from mojo::ApplicationDelegate: + // Overridden from mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; // Overridden from mojom::WebViewFactory: void CreateWebView(mojom::WebViewClientPtr client, mojo::InterfaceRequest<mojom::WebView> web_view) override; // Overridden from mojo::InterfaceFactory<mojom::WebView>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<mojom::WebViewFactory> request) override; mojo::Shell* shell_; diff --git a/components/web_view/web_view_apptest.cc b/components/web_view/web_view_apptest.cc index 475141d..391ca01 100644 --- a/components/web_view/web_view_apptest.cc +++ b/components/web_view/web_view_apptest.cc @@ -96,7 +96,7 @@ class WebViewTest : public mus::WindowServerTestBase, } } - // Overridden from ApplicationDelegate: + // Overridden from mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override { WindowServerTestBase::Initialize(shell, url, id); diff --git a/components/web_view/web_view_impl.cc b/components/web_view/web_view_impl.cc index c7d7ac2..00861b5 100644 --- a/components/web_view/web_view_impl.cc +++ b/components/web_view/web_view_impl.cc @@ -80,8 +80,7 @@ void WebViewImpl::OnLoad(const GURL& pending_url) { Frame::ClientPropertyMap client_properties; if (devtools_agent_) { devtools_service::DevToolsAgentPtr forward_agent; - frame_connection->application_connection()->ConnectToService( - &forward_agent); + frame_connection->connection()->ConnectToService(&forward_agent); devtools_agent_->AttachFrame(std::move(forward_agent), &client_properties); } diff --git a/content/browser/mojo/mojo_shell_context.cc b/content/browser/mojo/mojo_shell_context.cc index 012dc5f..f9a1f1c 100644 --- a/content/browser/mojo/mojo_shell_context.cc +++ b/content/browser/mojo/mojo_shell_context.cc @@ -27,7 +27,7 @@ #include "mojo/shell/connect_to_application_params.h" #include "mojo/shell/identity.h" #include "mojo/shell/package_manager/package_manager_impl.h" -#include "mojo/shell/public/cpp/application_delegate.h" +#include "mojo/shell/public/cpp/shell_client.h" #include "mojo/shell/static_application_loader.h" namespace content { diff --git a/content/browser/mojo/mojo_shell_context.h b/content/browser/mojo/mojo_shell_context.h index 846142c..7f4f5de 100644 --- a/content/browser/mojo/mojo_shell_context.h +++ b/content/browser/mojo/mojo_shell_context.h @@ -19,7 +19,7 @@ class GURL; namespace mojo { -class ApplicationDelegate; +class ShellClient; } namespace content { @@ -29,7 +29,7 @@ namespace content { class CONTENT_EXPORT MojoShellContext { public: using StaticApplicationMap = - std::map<GURL, base::Callback<scoped_ptr<mojo::ApplicationDelegate>()>>; + std::map<GURL, base::Callback<scoped_ptr<mojo::ShellClient>()>>; MojoShellContext(); ~MojoShellContext(); diff --git a/content/browser/mojo_shell_browsertest.cc b/content/browser/mojo_shell_browsertest.cc index b291961..75a263c 100644 --- a/content/browser/mojo_shell_browsertest.cc +++ b/content/browser/mojo_shell_browsertest.cc @@ -25,8 +25,8 @@ class MojoShellTest : public ContentBrowserTest { } private: - static scoped_ptr<mojo::ApplicationDelegate> CreateTestApp() { - return scoped_ptr<mojo::ApplicationDelegate>(new TestMojoApp); + static scoped_ptr<mojo::ShellClient> CreateTestApp() { + return scoped_ptr<mojo::ShellClient>(new TestMojoApp); } MojoShellContext::StaticApplicationMap test_apps_; diff --git a/content/common/mojo/mojo_shell_connection_impl.cc b/content/common/mojo/mojo_shell_connection_impl.cc index 95b9668..36004514 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_delegate.h" #include "mojo/shell/public/cpp/application_impl.h" +#include "mojo/shell/public/cpp/shell_client.h" #include "mojo/shell/runner/child/runner_connection.h" namespace content { @@ -78,8 +78,7 @@ void MojoShellConnectionImpl::Initialize(mojo::Shell* shell, initialized_ = true; } -bool MojoShellConnectionImpl::AcceptConnection( - mojo::ApplicationConnection* connection) { +bool MojoShellConnectionImpl::AcceptConnection(mojo::Connection* connection) { bool found = false; for (auto listener : listeners_) found |= listener->AcceptConnection(connection); diff --git a/content/common/mojo/mojo_shell_connection_impl.h b/content/common/mojo/mojo_shell_connection_impl.h index 2438138..d85fe0e 100644 --- a/content/common/mojo/mojo_shell_connection_impl.h +++ b/content/common/mojo/mojo_shell_connection_impl.h @@ -11,7 +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_delegate.h" +#include "mojo/shell/public/cpp/application_impl.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace mojo { namespace shell { @@ -25,7 +26,7 @@ namespace content { bool IsRunningInMojoShell(); class MojoShellConnectionImpl : public MojoShellConnection, - public mojo::ApplicationDelegate { + public mojo::ShellClient { public: // Creates an instance of this class and stuffs it in TLS on the calling // thread. Retrieve it using MojoShellConnection::Get(). @@ -49,11 +50,10 @@ class MojoShellConnectionImpl : public MojoShellConnection, MojoShellConnectionImpl(); ~MojoShellConnectionImpl() override; - // mojo::ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; // MojoShellConnection: mojo::Shell* GetShell() override; diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index e64048a..9e6c174 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -62,7 +62,7 @@ class CdmFactory; } namespace mojo { -class ApplicationDelegate; +class ShellClient; } namespace net { @@ -658,7 +658,7 @@ class CONTENT_EXPORT ContentBrowserClient { RenderFrameHost* render_frame_host) {} using StaticMojoApplicationMap = - std::map<GURL, base::Callback<scoped_ptr<mojo::ApplicationDelegate>()>>; + std::map<GURL, base::Callback<scoped_ptr<mojo::ShellClient>()>>; // Registers Mojo applications to be loaded in the browser process by the // browser's global Mojo shell. diff --git a/content/public/common/mojo_shell_connection.h b/content/public/common/mojo_shell_connection.h index 584073c..4f8d759 100644 --- a/content/public/common/mojo_shell_connection.h +++ b/content/public/common/mojo_shell_connection.h @@ -8,7 +8,7 @@ #include "content/common/content_export.h" namespace mojo { -class ApplicationConnection; +class Connection; class Shell; } @@ -24,10 +24,10 @@ namespace content { class CONTENT_EXPORT MojoShellConnection { public: // Override to add additional services to inbound connections. + // TODO(beng): This should just be ShellClient. class Listener { public: - virtual bool AcceptConnection( - mojo::ApplicationConnection* connection) = 0; + virtual bool AcceptConnection(mojo::Connection* connection) = 0; virtual ~Listener() {} }; diff --git a/content/public/test/test_mojo_app.cc b/content/public/test/test_mojo_app.cc index fe9b875..20a83f7 100644 --- a/content/public/test/test_mojo_app.cc +++ b/content/public/test/test_mojo_app.cc @@ -7,7 +7,7 @@ #include <utility> #include "base/logging.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" namespace content { @@ -25,14 +25,13 @@ void TestMojoApp::Initialize(mojo::Shell* shell, const std::string& url, shell_ = shell; } -bool TestMojoApp::AcceptConnection( - mojo::ApplicationConnection* connection) { +bool TestMojoApp::AcceptConnection(mojo::Connection* connection) { requestor_url_ = GURL(connection->GetRemoteApplicationURL()); connection->AddService<TestMojoService>(this); return true; } -void TestMojoApp::Create(mojo::ApplicationConnection* connection, +void TestMojoApp::Create(mojo::Connection* connection, mojo::InterfaceRequest<TestMojoService> request) { DCHECK(!service_binding_.is_bound()); service_binding_.Bind(std::move(request)); diff --git a/content/public/test/test_mojo_app.h b/content/public/test/test_mojo_app.h index 6659ad1..c354613 100644 --- a/content/public/test/test_mojo_app.h +++ b/content/public/test/test_mojo_app.h @@ -8,8 +8,8 @@ #include "base/macros.h" #include "content/public/test/test_mojo_service.mojom.h" #include "mojo/public/cpp/bindings/binding.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_client.h" #include "url/gurl.h" namespace content { @@ -18,7 +18,7 @@ extern const char kTestMojoAppUrl[]; // Simple Mojo app which provides a TestMojoService impl. The app terminates // itself after its TestService fulfills a single DoSomething call. -class TestMojoApp : public mojo::ApplicationDelegate, +class TestMojoApp : public mojo::ShellClient, public mojo::InterfaceFactory<TestMojoService>, public TestMojoService { public: @@ -26,14 +26,13 @@ class TestMojoApp : public mojo::ApplicationDelegate, ~TestMojoApp() override; private: - // mojo::ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; // mojo::InterfaceFactory<TestMojoService>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<TestMojoService> request) override; // TestMojoService: diff --git a/content/public/utility/content_utility_client.h b/content/public/utility/content_utility_client.h index b326eae..6ac42db 100644 --- a/content/public/utility/content_utility_client.h +++ b/content/public/utility/content_utility_client.h @@ -14,7 +14,7 @@ class GURL; namespace mojo { -class ApplicationDelegate; +class ShellClient; } namespace content { @@ -25,7 +25,7 @@ class ServiceRegistry; class CONTENT_EXPORT ContentUtilityClient { public: using StaticMojoApplicationMap = - std::map<GURL, base::Callback<scoped_ptr<mojo::ApplicationDelegate>()>>; + std::map<GURL, base::Callback<scoped_ptr<mojo::ShellClient>()>>; virtual ~ContentUtilityClient() {} diff --git a/content/renderer/mus/render_widget_window_tree_client_factory.cc b/content/renderer/mus/render_widget_window_tree_client_factory.cc index 81fb0f7..c2ed748 100644 --- a/content/renderer/mus/render_widget_window_tree_client_factory.cc +++ b/content/renderer/mus/render_widget_window_tree_client_factory.cc @@ -13,7 +13,7 @@ #include "content/public/common/mojo_shell_connection.h" #include "content/renderer/mus/render_widget_mus_connection.h" #include "mojo/common/weak_binding_set.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/interface_factory.h" #include "url/gurl.h" @@ -37,14 +37,13 @@ class RenderWidgetWindowTreeClientFactoryImpl private: // MojoShellConnection::Listener implementation: - bool AcceptConnection( - mojo::ApplicationConnection* connection) override { + bool AcceptConnection(mojo::Connection* connection) override { connection->AddService<mojom::RenderWidgetWindowTreeClientFactory>(this); return true; } // mojo::InterfaceFactory<mojom::RenderWidgetWindowTreeClientFactory>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<mojom::RenderWidgetWindowTreeClientFactory> request) override { bindings_.AddBinding(this, std::move(request)); diff --git a/content/shell/utility/shell_content_utility_client.cc b/content/shell/utility/shell_content_utility_client.cc index d6c2982..a21c083 100644 --- a/content/shell/utility/shell_content_utility_client.cc +++ b/content/shell/utility/shell_content_utility_client.cc @@ -13,8 +13,8 @@ namespace content { namespace { -scoped_ptr<mojo::ApplicationDelegate> CreateTestApp() { - return scoped_ptr<mojo::ApplicationDelegate>(new TestMojoApp); +scoped_ptr<mojo::ShellClient> CreateTestApp() { + return scoped_ptr<mojo::ShellClient>(new TestMojoApp); } } // namespace diff --git a/device/devices_app/devices_app.cc b/device/devices_app/devices_app.cc index 29a7484..a340644 100644 --- a/device/devices_app/devices_app.cc +++ b/device/devices_app/devices_app.cc @@ -18,7 +18,7 @@ #include "device/devices_app/usb/device_manager_impl.h" #include "device/usb/usb_service.h" #include "mojo/public/cpp/bindings/interface_request.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" #include "url/gurl.h" @@ -88,7 +88,7 @@ void DevicesApp::Initialize(mojo::Shell* shell, StartIdleTimer(); } -bool DevicesApp::AcceptConnection(mojo::ApplicationConnection* connection) { +bool DevicesApp::AcceptConnection(mojo::Connection* connection) { connection->AddService<usb::DeviceManager>(this); return true; } @@ -98,7 +98,7 @@ void DevicesApp::Quit() { shell_ = nullptr; } -void DevicesApp::Create(mojo::ApplicationConnection* connection, +void DevicesApp::Create(mojo::Connection* connection, mojo::InterfaceRequest<usb::DeviceManager> request) { // Bind the new device manager to the connecting application's permission // provider. diff --git a/device/devices_app/devices_app.h b/device/devices_app/devices_app.h index d247702..0fecb42 100644 --- a/device/devices_app/devices_app.h +++ b/device/devices_app/devices_app.h @@ -11,8 +11,8 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace mojo { class Shell; @@ -24,7 +24,7 @@ namespace usb { class DeviceManager; } -class DevicesApp : public mojo::ApplicationDelegate, +class DevicesApp : public mojo::ShellClient, public mojo::InterfaceFactory<usb::DeviceManager> { public: DevicesApp(); @@ -33,15 +33,15 @@ class DevicesApp : public mojo::ApplicationDelegate, private: class USBServiceInitializer; - // mojo::ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection(mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; void Quit() override; // mojo::InterfaceFactory<usb::DeviceManager>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<usb::DeviceManager> request) override; // Mojo error handler to track device manager count. diff --git a/device/devices_app/main.cc b/device/devices_app/main.cc index a43d8ff..1694aac 100644 --- a/device/devices_app/main.cc +++ b/device/devices_app/main.cc @@ -5,8 +5,8 @@ #include "base/sequenced_task_runner.h" #include "device/devices_app/public/cpp/devices_app_factory.h" #include "mojo/public/c/system/main.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/application_runner.h" +#include "mojo/shell/public/cpp/shell_client.h" MojoResult MojoMain(MojoHandle shell_handle) { mojo::ApplicationRunner runner( diff --git a/device/devices_app/public/cpp/devices_app_factory.cc b/device/devices_app/public/cpp/devices_app_factory.cc index a6ffe4e..154f67c 100644 --- a/device/devices_app/public/cpp/devices_app_factory.cc +++ b/device/devices_app/public/cpp/devices_app_factory.cc @@ -9,8 +9,8 @@ namespace device { // static -scoped_ptr<mojo::ApplicationDelegate> DevicesAppFactory::CreateApp() { - return scoped_ptr<mojo::ApplicationDelegate>(new DevicesApp()); +scoped_ptr<mojo::ShellClient> DevicesAppFactory::CreateApp() { + return scoped_ptr<mojo::ShellClient>(new DevicesApp()); } } // namespace device diff --git a/device/devices_app/public/cpp/devices_app_factory.h b/device/devices_app/public/cpp/devices_app_factory.h index ba03185..6ba7447 100644 --- a/device/devices_app/public/cpp/devices_app_factory.h +++ b/device/devices_app/public/cpp/devices_app_factory.h @@ -9,7 +9,7 @@ #include "base/memory/scoped_ptr.h" namespace mojo { -class ApplicationDelegate; +class ShellClient; } namespace device { @@ -20,7 +20,7 @@ class DevicesAppFactory { // Creates a DevicesApp delegate which can be used to launch a new instance // of the devices app on a mojo application runner. The caller owns the // delegate. - static scoped_ptr<mojo::ApplicationDelegate> CreateApp(); + static scoped_ptr<mojo::ShellClient> CreateApp(); }; } // namespace device diff --git a/mandoline/services/core_services/application_delegate_factory.h b/mandoline/services/core_services/application_delegate_factory.h index 537d9f9..60adff0 100644 --- a/mandoline/services/core_services/application_delegate_factory.h +++ b/mandoline/services/core_services/application_delegate_factory.h @@ -10,20 +10,20 @@ #include "base/memory/scoped_ptr.h" namespace mojo { -class ApplicationDelegate; +class ShellClient; } namespace core_services { -// This is always called to create a platform specific ApplicationDelegate. -scoped_ptr<mojo::ApplicationDelegate> CreatePlatformSpecificApplicationDelegate( +// This is always called to create a platform specific ShellClient. +scoped_ptr<mojo::ShellClient> CreatePlatformSpecificApplicationDelegate( const std::string& url); // The following are conditionally called. You do not need to call these from // CreatePlatformSpecificApplicationDelegate(), they are called (if appropriate) // before CreatePlatformSpecificApplicationDelegate(). #if !defined(OS_ANDROID) -scoped_ptr<mojo::ApplicationDelegate> CreateApplicationDelegateNotAndroid( +scoped_ptr<mojo::ShellClient> CreateApplicationDelegateNotAndroid( const std::string& url); #endif diff --git a/mandoline/services/core_services/application_delegate_factory_default.cc b/mandoline/services/core_services/application_delegate_factory_default.cc index d069134..6a62978 100644 --- a/mandoline/services/core_services/application_delegate_factory_default.cc +++ b/mandoline/services/core_services/application_delegate_factory_default.cc @@ -4,11 +4,11 @@ #include "mandoline/services/core_services/application_delegate_factory.h" -#include "mojo/shell/public/cpp/application_delegate.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace core_services { -scoped_ptr<mojo::ApplicationDelegate> CreatePlatformSpecificApplicationDelegate( +scoped_ptr<mojo::ShellClient> CreatePlatformSpecificApplicationDelegate( const std::string& url) { return nullptr; } diff --git a/mandoline/services/core_services/application_delegate_factory_linux.cc b/mandoline/services/core_services/application_delegate_factory_linux.cc index fe14ee4..652d597 100644 --- a/mandoline/services/core_services/application_delegate_factory_linux.cc +++ b/mandoline/services/core_services/application_delegate_factory_linux.cc @@ -8,7 +8,7 @@ namespace core_services { -scoped_ptr<mojo::ApplicationDelegate> CreatePlatformSpecificApplicationDelegate( +scoped_ptr<mojo::ShellClient> CreatePlatformSpecificApplicationDelegate( const std::string& url) { return url == "mojo://font_service/" ? make_scoped_ptr(new font_service::FontServiceApp) diff --git a/mandoline/services/core_services/application_delegate_factory_notandroid.cc b/mandoline/services/core_services/application_delegate_factory_notandroid.cc index 6756c99..8ea2af0 100644 --- a/mandoline/services/core_services/application_delegate_factory_notandroid.cc +++ b/mandoline/services/core_services/application_delegate_factory_notandroid.cc @@ -10,7 +10,7 @@ namespace core_services { -scoped_ptr<mojo::ApplicationDelegate> CreateApplicationDelegateNotAndroid( +scoped_ptr<mojo::ShellClient> CreateApplicationDelegateNotAndroid( const std::string& url) { if (url == "mojo://network_service/") return make_scoped_ptr(new mojo::NetworkServiceDelegate); diff --git a/mandoline/services/core_services/core_services_application_delegate.cc b/mandoline/services/core_services/core_services_application_delegate.cc index efd21d0..f20b7df 100644 --- a/mandoline/services/core_services/core_services_application_delegate.cc +++ b/mandoline/services/core_services/core_services_application_delegate.cc @@ -19,8 +19,8 @@ #include "mojo/message_pump/message_pump_mojo.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" #include "mojo/services/tracing/tracing_app.h" -#include "mojo/shell/public/cpp/application_connection.h" #include "mojo/shell/public/cpp/application_runner.h" +#include "mojo/shell/public/cpp/connection.h" #include "url/gurl.h" namespace core_services { @@ -32,7 +32,7 @@ class ApplicationThread : public base::SimpleThread { const base::WeakPtr<CoreServicesApplicationDelegate> core_services_application, const std::string& url, - scoped_ptr<mojo::ApplicationDelegate> delegate, + scoped_ptr<mojo::ShellClient> delegate, mojo::InterfaceRequest<mojo::shell::mojom::Application> request, const mojo::Callback<void()>& destruct_callback) : base::SimpleThread(url), @@ -72,7 +72,7 @@ class ApplicationThread : public base::SimpleThread { scoped_refptr<base::SingleThreadTaskRunner> core_services_application_task_runner_; std::string url_; - scoped_ptr<mojo::ApplicationDelegate> delegate_; + scoped_ptr<mojo::ShellClient> delegate_; mojo::InterfaceRequest<mojo::shell::mojom::Application> request_; mojo::Callback<void()> destruct_callback_; @@ -105,7 +105,7 @@ void CoreServicesApplicationDelegate::Initialize(mojo::Shell* shell, } bool CoreServicesApplicationDelegate::AcceptConnection( - mojo::ApplicationConnection* connection) { + mojo::Connection* connection) { connection->AddService(this); return true; } @@ -118,7 +118,7 @@ void CoreServicesApplicationDelegate::Quit() { } void CoreServicesApplicationDelegate::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<mojo::shell::mojom::ContentHandler> request) { handler_bindings_.AddBinding(this, std::move(request)); } @@ -129,7 +129,7 @@ void CoreServicesApplicationDelegate::StartApplication( const mojo::Callback<void()>& destruct_callback) { const std::string url = response->url; - scoped_ptr<mojo::ApplicationDelegate> delegate; + scoped_ptr<mojo::ShellClient> delegate; if (url == "mojo://clipboard/") { delegate.reset(new clipboard::ClipboardApplicationDelegate); } else if (url == "mojo://filesystem/") { diff --git a/mandoline/services/core_services/core_services_application_delegate.h b/mandoline/services/core_services/core_services_application_delegate.h index b50b491..55f5387 100644 --- a/mandoline/services/core_services/core_services_application_delegate.h +++ b/mandoline/services/core_services/core_services_application_delegate.h @@ -11,8 +11,8 @@ #include "components/clipboard/public/interfaces/clipboard.mojom.h" #include "mojo/common/weak_binding_set.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory_impl.h" +#include "mojo/shell/public/cpp/shell_client.h" #include "mojo/shell/public/interfaces/content_handler.mojom.h" namespace core_services { @@ -22,7 +22,7 @@ class ApplicationThread; // The CoreServices application is a singleton ServiceProvider. There is one // instance of the CoreServices ServiceProvider. class CoreServicesApplicationDelegate - : public mojo::ApplicationDelegate, + : public mojo::ShellClient, public mojo::InterfaceFactory<mojo::shell::mojom::ContentHandler>, public mojo::shell::mojom::ContentHandler { public: @@ -32,16 +32,15 @@ class CoreServicesApplicationDelegate void ApplicationThreadDestroyed(ApplicationThread* thread); private: - // Overridden from mojo::ApplicationDelegate: + // Overridden from mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; void Quit() override; // Overridden from mojo::InterfaceFactory<mojo::shell::mojom::ContentHandler>: void Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<mojo::shell::mojom::ContentHandler> request) override; diff --git a/mandoline/services/updater/updater_app.cc b/mandoline/services/updater/updater_app.cc index e94dff4..ffb9493 100644 --- a/mandoline/services/updater/updater_app.cc +++ b/mandoline/services/updater/updater_app.cc @@ -9,8 +9,8 @@ #include "base/logging.h" #include "mandoline/services/updater/updater_impl.h" #include "mojo/public/c/system/main.h" -#include "mojo/shell/public/cpp/application_connection.h" #include "mojo/shell/public/cpp/application_runner.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" namespace updater { @@ -26,13 +26,12 @@ void UpdaterApp::Initialize(mojo::Shell* shell, const std::string& url, shell_ = shell; } -bool UpdaterApp::AcceptConnection( - mojo::ApplicationConnection* connection) { +bool UpdaterApp::AcceptConnection(mojo::Connection* connection) { connection->AddService<Updater>(this); return true; } -void UpdaterApp::Create(mojo::ApplicationConnection* connection, +void UpdaterApp::Create(mojo::Connection* connection, mojo::InterfaceRequest<Updater> request) { new UpdaterImpl(this, std::move(request)); } diff --git a/mandoline/services/updater/updater_app.h b/mandoline/services/updater/updater_app.h index 818efb9..134d1ea 100644 --- a/mandoline/services/updater/updater_app.h +++ b/mandoline/services/updater/updater_app.h @@ -6,11 +6,11 @@ #define MANDOLINE_SERVICES_UPDATER_UPDATER_APP_H_ #include "base/macros.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace mojo { -class ApplicationConnection; +class Connection; class Shell; } // namespace mojo @@ -18,20 +18,19 @@ namespace updater { class Updater; -class UpdaterApp : public mojo::ApplicationDelegate, +class UpdaterApp : public mojo::ShellClient, public mojo::InterfaceFactory<Updater> { public: UpdaterApp(); ~UpdaterApp() override; - // mojo::ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; // InterfaceFactory<Updater> implementation. - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<Updater> request) override; private: diff --git a/mandoline/ui/desktop_ui/browser_manager.cc b/mandoline/ui/desktop_ui/browser_manager.cc index b3a5123..b43b18e 100644 --- a/mandoline/ui/desktop_ui/browser_manager.cc +++ b/mandoline/ui/desktop_ui/browser_manager.cc @@ -70,13 +70,12 @@ void BrowserManager::Initialize(mojo::Shell* shell, const std::string& url, CreateBrowser(GURL(kGoogleURL)); } -bool BrowserManager::AcceptConnection( - mojo::ApplicationConnection* connection) { +bool BrowserManager::AcceptConnection(mojo::Connection* connection) { connection->AddService<LaunchHandler>(this); return true; } -void BrowserManager::Create(mojo::ApplicationConnection* connection, +void BrowserManager::Create(mojo::Connection* connection, mojo::InterfaceRequest<LaunchHandler> request) { launch_handler_bindings_.AddBinding(this, std::move(request)); } diff --git a/mandoline/ui/desktop_ui/browser_manager.h b/mandoline/ui/desktop_ui/browser_manager.h index 77becea..aec4171 100644 --- a/mandoline/ui/desktop_ui/browser_manager.h +++ b/mandoline/ui/desktop_ui/browser_manager.h @@ -12,7 +12,7 @@ #include "mandoline/ui/desktop_ui/public/interfaces/launch_handler.mojom.h" #include "mojo/common/weak_binding_set.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_delegate.h" +#include "mojo/shell/public/cpp/shell_client.h" #include "url/gurl.h" namespace mojo { @@ -24,7 +24,7 @@ namespace mandoline { class BrowserWindow; // BrowserManager creates and manages the lifetime of Browsers. -class BrowserManager : public mojo::ApplicationDelegate, +class BrowserManager : public mojo::ShellClient, public LaunchHandler, public mojo::InterfaceFactory<LaunchHandler> { public: @@ -43,14 +43,13 @@ class BrowserManager : public mojo::ApplicationDelegate, // Overridden from LaunchHandler: void LaunchURL(const mojo::String& url) override; - // Overridden from mojo::ApplicationDelegate: + // Overridden from mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; // Overridden from mojo::InterfaceFactory<LaunchHandler>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<LaunchHandler> request) override; mojo::Shell* shell_; diff --git a/mandoline/ui/desktop_ui/browser_window.cc b/mandoline/ui/desktop_ui/browser_window.cc index b87a604..a180220 100644 --- a/mandoline/ui/desktop_ui/browser_window.cc +++ b/mandoline/ui/desktop_ui/browser_window.cc @@ -391,7 +391,7 @@ void BrowserWindow::Embed(mojo::URLRequestPtr request) { //////////////////////////////////////////////////////////////////////////////// // BrowserWindow, mojo::InterfaceFactory<ViewEmbedder> implementation: -void BrowserWindow::Create(mojo::ApplicationConnection* connection, +void BrowserWindow::Create(mojo::Connection* connection, mojo::InterfaceRequest<ViewEmbedder> request) { view_embedder_bindings_.AddBinding(this, std::move(request)); } diff --git a/mandoline/ui/desktop_ui/browser_window.h b/mandoline/ui/desktop_ui/browser_window.h index 31d1880..08e7999 100644 --- a/mandoline/ui/desktop_ui/browser_window.h +++ b/mandoline/ui/desktop_ui/browser_window.h @@ -22,7 +22,7 @@ #include "url/gurl.h" namespace mojo { -class ApplicationConnection; +class Connection; class Shell; } @@ -101,7 +101,7 @@ class BrowserWindow : public mus::WindowTreeDelegate, void Embed(mojo::URLRequestPtr request) override; // Overridden from mojo::InterfaceFactory<ViewEmbedder>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<ViewEmbedder> request) override; @@ -141,7 +141,7 @@ class BrowserWindow : public mus::WindowTreeDelegate, web_view::WebView web_view_; OmniboxPtr omnibox_; - scoped_ptr<mojo::ApplicationConnection> omnibox_connection_; + scoped_ptr<mojo::Connection> omnibox_connection_; DISALLOW_COPY_AND_ASSIGN(BrowserWindow); }; diff --git a/mandoline/ui/omnibox/omnibox_application.cc b/mandoline/ui/omnibox/omnibox_application.cc index 7674d0d..0ee9c5b 100644 --- a/mandoline/ui/omnibox/omnibox_application.cc +++ b/mandoline/ui/omnibox/omnibox_application.cc @@ -37,7 +37,7 @@ class OmniboxImpl : public mus::WindowTreeDelegate, public Omnibox { public: OmniboxImpl(mojo::Shell* shell, - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<Omnibox> request); ~OmniboxImpl() override; @@ -81,7 +81,7 @@ OmniboxApplication::OmniboxApplication() : shell_(nullptr) {} OmniboxApplication::~OmniboxApplication() {} //////////////////////////////////////////////////////////////////////////////// -// OmniboxApplication, mojo::ApplicationDelegate implementation: +// OmniboxApplication, mojo::ShellClient implementation: void OmniboxApplication::Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) { @@ -89,8 +89,7 @@ void OmniboxApplication::Initialize(mojo::Shell* shell, const std::string& url, tracing_.Initialize(shell, url); } -bool OmniboxApplication::AcceptConnection( - mojo::ApplicationConnection* connection) { +bool OmniboxApplication::AcceptConnection(mojo::Connection* connection) { connection->AddService<Omnibox>(this); return true; } @@ -98,7 +97,7 @@ bool OmniboxApplication::AcceptConnection( //////////////////////////////////////////////////////////////////////////////// // OmniboxApplication, mojo::InterfaceFactory<Omnibox> implementation: -void OmniboxApplication::Create(mojo::ApplicationConnection* connection, +void OmniboxApplication::Create(mojo::Connection* connection, mojo::InterfaceRequest<Omnibox> request) { new OmniboxImpl(shell_, connection, std::move(request)); } @@ -107,7 +106,7 @@ void OmniboxApplication::Create(mojo::ApplicationConnection* connection, // OmniboxImpl, public: OmniboxImpl::OmniboxImpl(mojo::Shell* shell, - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<Omnibox> request) : shell_(shell), root_(nullptr), diff --git a/mandoline/ui/omnibox/omnibox_application.h b/mandoline/ui/omnibox/omnibox_application.h index 91df2a0..cb705c3 100644 --- a/mandoline/ui/omnibox/omnibox_application.h +++ b/mandoline/ui/omnibox/omnibox_application.h @@ -8,8 +8,8 @@ #include "base/macros.h" #include "mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace mojo { class Shell; @@ -17,21 +17,20 @@ class Shell; namespace mandoline { -class OmniboxApplication : public mojo::ApplicationDelegate, +class OmniboxApplication : public mojo::ShellClient, public mojo::InterfaceFactory<Omnibox> { public: OmniboxApplication(); ~OmniboxApplication() override; private: - // Overridden from mojo::ApplicationDelegate: + // Overridden from mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; // Overridden from mojo::InterfaceFactory<Omnibox>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<Omnibox> request) override; mojo::Shell* shell_; diff --git a/mandoline/ui/phone_ui/phone_browser_application_delegate.cc b/mandoline/ui/phone_ui/phone_browser_application_delegate.cc index 666cafb..4cafb3c 100644 --- a/mandoline/ui/phone_ui/phone_browser_application_delegate.cc +++ b/mandoline/ui/phone_ui/phone_browser_application_delegate.cc @@ -10,7 +10,7 @@ #include "components/mus/public/cpp/window_tree_host_factory.h" #include "mojo/converters/geometry/geometry_type_converters.h" #include "mojo/services/network/public/interfaces/url_loader.mojom.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" #include "ui/gfx/geometry/size.h" #include "url/gurl.h" @@ -34,7 +34,7 @@ PhoneBrowserApplicationDelegate::~PhoneBrowserApplicationDelegate() { } //////////////////////////////////////////////////////////////////////////////// -// PhoneBrowserApplicationDelegate, mojo::ApplicationDelegate implementation: +// PhoneBrowserApplicationDelegate, mojo::ShellClient implementation: void PhoneBrowserApplicationDelegate::Initialize(mojo::Shell* shell, const std::string& url, @@ -53,7 +53,7 @@ void PhoneBrowserApplicationDelegate::Initialize(mojo::Shell* shell, } bool PhoneBrowserApplicationDelegate::AcceptConnection( - mojo::ApplicationConnection* connection) { + mojo::Connection* connection) { connection->AddService<LaunchHandler>(this); return true; } @@ -127,7 +127,7 @@ void PhoneBrowserApplicationDelegate::TitleChanged(const mojo::String& title) { // mojo::InterfaceFactory<LaunchHandler> implementation: void PhoneBrowserApplicationDelegate::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<LaunchHandler> request) { launch_handler_bindings_.AddBinding(this, request.Pass()); } diff --git a/mandoline/ui/phone_ui/phone_browser_application_delegate.h b/mandoline/ui/phone_ui/phone_browser_application_delegate.h index 6d85257..050c6d9 100644 --- a/mandoline/ui/phone_ui/phone_browser_application_delegate.h +++ b/mandoline/ui/phone_ui/phone_browser_application_delegate.h @@ -17,8 +17,8 @@ // TODO(beng): move this file somewhere common. #include "mandoline/ui/desktop_ui/public/interfaces/launch_handler.mojom.h" #include "mojo/common/weak_binding_set.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace mus { class View; @@ -27,7 +27,7 @@ class View; namespace mandoline { class PhoneBrowserApplicationDelegate - : public mojo::ApplicationDelegate, + : public mojo::ShellClient, public LaunchHandler, public mus::WindowTreeDelegate, public mus::WindowObserver, @@ -38,11 +38,10 @@ class PhoneBrowserApplicationDelegate ~PhoneBrowserApplicationDelegate() override; private: - // Overridden from mojo::ApplicationDelegate: + // Overridden from mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; // Overridden from LaunchHandler: void LaunchURL(const mojo::String& url) override; @@ -70,7 +69,7 @@ class PhoneBrowserApplicationDelegate int32_t active_match_ordinal) override {} // Overridden from mojo::InterfaceFactory<LaunchHandler>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<LaunchHandler> request) override; mojo::Shell* shell_; diff --git a/mash/browser_driver/browser_driver_application_delegate.cc b/mash/browser_driver/browser_driver_application_delegate.cc index 7314f08..4765719 100644 --- a/mash/browser_driver/browser_driver_application_delegate.cc +++ b/mash/browser_driver/browser_driver_application_delegate.cc @@ -8,7 +8,7 @@ #include "base/bind.h" #include "components/mus/public/cpp/event_matcher.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" namespace mash { @@ -58,7 +58,7 @@ void BrowserDriverApplicationDelegate::Initialize(mojo::Shell* shell, } bool BrowserDriverApplicationDelegate::AcceptConnection( - mojo::ApplicationConnection* connection) { + mojo::Connection* connection) { return true; } diff --git a/mash/browser_driver/browser_driver_application_delegate.h b/mash/browser_driver/browser_driver_application_delegate.h index f832308..2c1f981 100644 --- a/mash/browser_driver/browser_driver_application_delegate.h +++ b/mash/browser_driver/browser_driver_application_delegate.h @@ -14,27 +14,22 @@ #include "base/memory/scoped_ptr.h" #include "components/mus/public/interfaces/accelerator_registrar.mojom.h" #include "mojo/public/cpp/bindings/binding.h" -#include "mojo/shell/public/cpp/application_delegate.h" - -namespace mojo { -class ApplicationConnection; -} +#include "mojo/shell/public/cpp/shell_client.h" namespace mash { namespace browser_driver { -class BrowserDriverApplicationDelegate : public mojo::ApplicationDelegate, +class BrowserDriverApplicationDelegate : public mojo::ShellClient, public mus::mojom::AcceleratorHandler { public: BrowserDriverApplicationDelegate(); ~BrowserDriverApplicationDelegate() override; private: - // mojo::ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; // mus::mojom::AcceleratorHandler: void OnAccelerator(uint32_t id, mus::mojom::EventPtr event) override; diff --git a/mash/example/views_examples/views_examples_application_delegate.cc b/mash/example/views_examples/views_examples_application_delegate.cc index dc675ab..ccdb1af 100644 --- a/mash/example/views_examples/views_examples_application_delegate.cc +++ b/mash/example/views_examples/views_examples_application_delegate.cc @@ -4,7 +4,7 @@ #include "mash/example/views_examples/views_examples_application_delegate.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" #include "ui/views/examples/example_base.h" #include "ui/views/examples/examples_window.h" @@ -29,6 +29,6 @@ void ViewsExamplesApplicationDelegate::Initialize(mojo::Shell* shell, } bool ViewsExamplesApplicationDelegate::AcceptConnection( - mojo::ApplicationConnection* connection) { + mojo::Connection* connection) { return false; } diff --git a/mash/example/views_examples/views_examples_application_delegate.h b/mash/example/views_examples/views_examples_application_delegate.h index 2909126..a8d9a4f 100644 --- a/mash/example/views_examples/views_examples_application_delegate.h +++ b/mash/example/views_examples/views_examples_application_delegate.h @@ -8,23 +8,22 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_delegate.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace views { class AuraInit; } -class ViewsExamplesApplicationDelegate : public mojo::ApplicationDelegate { +class ViewsExamplesApplicationDelegate : public mojo::ShellClient { public: ViewsExamplesApplicationDelegate(); ~ViewsExamplesApplicationDelegate() override; private: - // ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; mojo::TracingImpl tracing_; diff --git a/mash/example/window_type_launcher/window_type_launcher.cc b/mash/example/window_type_launcher/window_type_launcher.cc index 6f4d5b1..14ffd16 100644 --- a/mash/example/window_type_launcher/window_type_launcher.cc +++ b/mash/example/window_type_launcher/window_type_launcher.cc @@ -8,7 +8,7 @@ #include "base/strings/utf_string_conversions.h" #include "mash/shell/public/interfaces/shell.mojom.h" #include "mojo/converters/geometry/geometry_type_converters.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" #include "ui/aura/window.h" #include "ui/aura/window_event_dispatcher.h" @@ -355,11 +355,6 @@ class WindowTypeLauncherView : public views::WidgetDelegateView, WindowTypeLauncher::WindowTypeLauncher() {} WindowTypeLauncher::~WindowTypeLauncher() {} -bool WindowTypeLauncher::AcceptConnection( - mojo::ApplicationConnection* connection) { - return false; -} - void WindowTypeLauncher::Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) { aura_init_.reset(new views::AuraInit(shell, "views_mus_resources.pak")); diff --git a/mash/example/window_type_launcher/window_type_launcher.h b/mash/example/window_type_launcher/window_type_launcher.h index 34e283c..e1d9c6e 100644 --- a/mash/example/window_type_launcher/window_type_launcher.h +++ b/mash/example/window_type_launcher/window_type_launcher.h @@ -7,23 +7,21 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" -#include "mojo/shell/public/cpp/application_delegate.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace views { class AuraInit; } -class WindowTypeLauncher : public mojo::ApplicationDelegate { +class WindowTypeLauncher : public mojo::ShellClient { public: WindowTypeLauncher(); ~WindowTypeLauncher() override; private: - // ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; scoped_ptr<views::AuraInit> aura_init_; diff --git a/mash/quick_launch/quick_launch.cc b/mash/quick_launch/quick_launch.cc index 369cd7c..41a18d0 100644 --- a/mash/quick_launch/quick_launch.cc +++ b/mash/quick_launch/quick_launch.cc @@ -7,9 +7,9 @@ #include "base/strings/utf_string_conversions.h" #include "mojo/public/c/system/main.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/application_runner.h" #include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/shell_client.h" #include "ui/views/background.h" #include "ui/views/controls/textfield/textfield.h" #include "ui/views/controls/textfield/textfield_controller.h" @@ -79,18 +79,18 @@ class QuickLaunchUI : public views::WidgetDelegateView, mojo::Shell* shell_; views::Textfield* prompt_; - std::vector<scoped_ptr<mojo::ApplicationConnection>> connections_; + std::vector<scoped_ptr<mojo::Connection>> connections_; DISALLOW_COPY_AND_ASSIGN(QuickLaunchUI); }; -class QuickLaunchApplicationDelegate : public mojo::ApplicationDelegate { +class QuickLaunchApplicationDelegate : public mojo::ShellClient { public: QuickLaunchApplicationDelegate() {} ~QuickLaunchApplicationDelegate() override {} private: - // mojo::ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override { tracing_.Initialize(shell, url); diff --git a/mash/screenlock/screenlock.h b/mash/screenlock/screenlock.h index ff6b9bb..3d6bfb6 100644 --- a/mash/screenlock/screenlock.h +++ b/mash/screenlock/screenlock.h @@ -12,7 +12,7 @@ #include "mash/shell/public/interfaces/shell.mojom.h" #include "mojo/common/weak_binding_set.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_delegate.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace views { class AuraInit; @@ -21,14 +21,14 @@ class AuraInit; namespace mash { namespace screenlock { -class Screenlock : public mojo::ApplicationDelegate, +class Screenlock : public mojo::ShellClient, public shell::mojom::ScreenlockStateListener { public: Screenlock(); ~Screenlock() override; private: - // mojo::ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; diff --git a/mash/shelf/shelf_application.h b/mash/shelf/shelf_application.h index ab74f2c..ea9354c 100644 --- a/mash/shelf/shelf_application.h +++ b/mash/shelf/shelf_application.h @@ -8,7 +8,7 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_delegate.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace views { class AuraInit; @@ -17,13 +17,13 @@ class AuraInit; namespace mash { namespace shelf { -class ShelfApplication : public mojo::ApplicationDelegate { +class ShelfApplication : public mojo::ShellClient { public: ShelfApplication(); ~ShelfApplication() override; private: - // mojo::ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; diff --git a/mash/shell/shell_application_delegate.cc b/mash/shell/shell_application_delegate.cc index 560edde..6f919d5 100644 --- a/mash/shell/shell_application_delegate.cc +++ b/mash/shell/shell_application_delegate.cc @@ -5,7 +5,7 @@ #include "mash/shell/shell_application_delegate.h" #include "base/bind.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" namespace mash { @@ -27,8 +27,7 @@ void ShellApplicationDelegate::Initialize(mojo::Shell* shell, StartQuickLaunch(); } -bool ShellApplicationDelegate::AcceptConnection( - mojo::ApplicationConnection* connection) { +bool ShellApplicationDelegate::AcceptConnection(mojo::Connection* connection) { connection->AddService<mash::shell::mojom::Shell>(this); return true; } @@ -61,7 +60,7 @@ void ShellApplicationDelegate::UnlockScreen() { } void ShellApplicationDelegate::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<mash::shell::mojom::Shell> r) { bindings_.AddBinding(this, std::move(r)); } @@ -117,7 +116,7 @@ void ShellApplicationDelegate::StartRestartableService( const base::Closure& restart_callback) { // TODO(beng): This would be the place to insert logic that counted restarts // to avoid infinite crash-restart loops. - scoped_ptr<mojo::ApplicationConnection> connection = + scoped_ptr<mojo::Connection> connection = shell_->ConnectToApplication(url); connection->SetRemoteServiceProviderConnectionErrorHandler(restart_callback); connections_[url] = std::move(connection); diff --git a/mash/shell/shell_application_delegate.h b/mash/shell/shell_application_delegate.h index a36a91a..dc81282 100644 --- a/mash/shell/shell_application_delegate.h +++ b/mash/shell/shell_application_delegate.h @@ -13,18 +13,18 @@ #include "mash/shell/public/interfaces/shell.mojom.h" #include "mojo/common/weak_binding_set.h" #include "mojo/common/weak_interface_ptr_set.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace mojo { -class ApplicationConnection; +class Connection; } namespace mash { namespace shell { class ShellApplicationDelegate - : public mojo::ApplicationDelegate, + : public mojo::ShellClient, public mash::shell::mojom::Shell, public mojo::InterfaceFactory<mash::shell::mojom::Shell> { public: @@ -32,11 +32,10 @@ class ShellApplicationDelegate ~ShellApplicationDelegate() override; private: - // mojo::ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; // mash::shell::mojom::Shell: void AddScreenlockStateListener( @@ -45,7 +44,7 @@ class ShellApplicationDelegate void UnlockScreen() override; // mojo::InterfaceFactory<mash::shell::mojom::Shell>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<mash::shell::mojom::Shell> r) override; void StartWindowManager(); @@ -63,7 +62,7 @@ class ShellApplicationDelegate const base::Closure& restart_callback); mojo::Shell* shell_; - std::map<std::string, scoped_ptr<mojo::ApplicationConnection>> connections_; + std::map<std::string, scoped_ptr<mojo::Connection>> connections_; bool screen_locked_; mojo::WeakBindingSet<mash::shell::mojom::Shell> bindings_; mojo::WeakInterfacePtrSet<mojom::ScreenlockStateListener> diff --git a/mash/task_viewer/task_viewer_application_delegate.cc b/mash/task_viewer/task_viewer_application_delegate.cc index cac01ee3..ff3f9d3 100644 --- a/mash/task_viewer/task_viewer_application_delegate.cc +++ b/mash/task_viewer/task_viewer_application_delegate.cc @@ -13,7 +13,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "mojo/public/cpp/bindings/binding.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" #include "mojo/shell/public/interfaces/application_manager.mojom.h" #include "ui/base/models/table_model.h" diff --git a/mash/task_viewer/task_viewer_application_delegate.h b/mash/task_viewer/task_viewer_application_delegate.h index efd84c6..d6d122d 100644 --- a/mash/task_viewer/task_viewer_application_delegate.h +++ b/mash/task_viewer/task_viewer_application_delegate.h @@ -11,11 +11,7 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_delegate.h" - -namespace mojo { -class ApplicationConnection; -} +#include "mojo/shell/public/cpp/shell_client.h" namespace views { class AuraInit; @@ -24,13 +20,13 @@ class AuraInit; namespace mash { namespace task_viewer { -class TaskViewerApplicationDelegate : public mojo::ApplicationDelegate { +class TaskViewerApplicationDelegate : public mojo::ShellClient { public: TaskViewerApplicationDelegate(); ~TaskViewerApplicationDelegate() override; private: - // mojo::ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; diff --git a/mash/wallpaper/wallpaper.cc b/mash/wallpaper/wallpaper.cc index ab50ddc..d53c9f5 100644 --- a/mash/wallpaper/wallpaper.cc +++ b/mash/wallpaper/wallpaper.cc @@ -9,10 +9,9 @@ #include "mash/wm/public/interfaces/container.mojom.h" #include "mojo/public/c/system/main.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_connection.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/application_runner.h" #include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/shell_client.h" #include "ui/gfx/canvas.h" #include "ui/views/mus/aura_init.h" #include "ui/views/mus/native_widget_mus.h" @@ -39,7 +38,7 @@ class Wallpaper : public views::WidgetDelegateView { DISALLOW_COPY_AND_ASSIGN(Wallpaper); }; -class WallpaperApplicationDelegate : public mojo::ApplicationDelegate { +class WallpaperApplicationDelegate : public mojo::ShellClient { public: WallpaperApplicationDelegate() {} ~WallpaperApplicationDelegate() override {} @@ -49,7 +48,7 @@ class WallpaperApplicationDelegate : public mojo::ApplicationDelegate { } private: - // mojo::ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override { tracing_.Initialize(shell, url); diff --git a/mash/wm/window_manager_application.cc b/mash/wm/window_manager_application.cc index 47570a5..5a0a5ab 100644 --- a/mash/wm/window_manager_application.cc +++ b/mash/wm/window_manager_application.cc @@ -15,7 +15,7 @@ #include "mash/wm/root_windows_observer.h" #include "mash/wm/user_window_controller_impl.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" #include "ui/mojo/init/ui_init.h" #include "ui/views/mus/aura_init.h" @@ -120,15 +120,14 @@ void WindowManagerApplication::Initialize(mojo::Shell* shell, RootWindowController::CreateUsingWindowTreeHost(this)); } -bool WindowManagerApplication::AcceptConnection( - mojo::ApplicationConnection* connection) { +bool WindowManagerApplication::AcceptConnection(mojo::Connection* connection) { connection->AddService<mash::wm::mojom::UserWindowController>(this); connection->AddService<mus::mojom::AcceleratorRegistrar>(this); return true; } void WindowManagerApplication::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<mash::wm::mojom::UserWindowController> request) { if (!root_controllers_.empty() && (*root_controllers_.begin())->root()) { user_window_controller_binding_.AddBinding(user_window_controller_.get(), @@ -141,7 +140,7 @@ void WindowManagerApplication::Create( } void WindowManagerApplication::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<mus::mojom::AcceleratorRegistrar> request) { static int accelerator_registrar_count = 0; if (accelerator_registrar_count == std::numeric_limits<int>::max()) { diff --git a/mash/wm/window_manager_application.h b/mash/wm/window_manager_application.h index 19c7d33..f5ef9e1 100644 --- a/mash/wm/window_manager_application.h +++ b/mash/wm/window_manager_application.h @@ -21,7 +21,7 @@ #include "mojo/common/weak_binding_set.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_delegate.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace ui { namespace mojo { @@ -42,7 +42,7 @@ class RootWindowsObserver; class UserWindowControllerImpl; class WindowManagerApplication - : public mojo::ApplicationDelegate, + : public mojo::ShellClient, public mus::mojom::WindowManagerFactory, public mojo::InterfaceFactory<mash::wm::mojom::UserWindowController>, public mojo::InterfaceFactory<mus::mojom::AcceleratorRegistrar> { @@ -77,19 +77,18 @@ class WindowManagerApplication private: void OnAcceleratorRegistrarDestroyed(AcceleratorRegistrarImpl* registrar); - // ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + bool AcceptConnection(mojo::Connection* connection) override; // InterfaceFactory<mash::wm::mojom::UserWindowController>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<mash::wm::mojom::UserWindowController> request) override; // InterfaceFactory<mus::mojom::AcceleratorRegistrar>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<mus::mojom::AcceleratorRegistrar> request) override; diff --git a/media/mojo/services/main.cc b/media/mojo/services/main.cc index 046fa0c..b3df5c8 100644 --- a/media/mojo/services/main.cc +++ b/media/mojo/services/main.cc @@ -14,7 +14,7 @@ MojoResult MojoMain(MojoHandle mojo_handle) { mojo::ApplicationRunner::InitBaseCommandLine(); mojo::InitLogging(); - scoped_ptr<mojo::ApplicationDelegate> app_delegate = + scoped_ptr<mojo::ShellClient> app_delegate = media::MojoMediaApplication::CreateApp(); mojo::ApplicationRunner runner(app_delegate.release()); return runner.Run(mojo_handle, false /* init_base */); diff --git a/media/mojo/services/media_apptest.cc b/media/mojo/services/media_apptest.cc index 27b525d..0d88334 100644 --- a/media/mojo/services/media_apptest.cc +++ b/media/mojo/services/media_apptest.cc @@ -20,7 +20,6 @@ #include "media/mojo/interfaces/service_factory.mojom.h" #include "media/mojo/services/media_type_converters.h" #include "media/mojo/services/mojo_demuxer_stream_impl.h" -#include "mojo/shell/public/cpp/application_connection.h" #include "mojo/shell/public/cpp/application_test_base.h" #include "testing/gmock/include/gmock/gmock.h" @@ -124,7 +123,7 @@ class MediaAppTest : public mojo::test::ApplicationTestBase { StrictMock<MockDemuxerStream> video_demuxer_stream_; private: - scoped_ptr<mojo::ApplicationConnection> connection_; + scoped_ptr<mojo::Connection> connection_; DISALLOW_COPY_AND_ASSIGN(MediaAppTest); }; diff --git a/media/mojo/services/mojo_media_application.cc b/media/mojo/services/mojo_media_application.cc index 4722908..a84ef88 100644 --- a/media/mojo/services/mojo_media_application.cc +++ b/media/mojo/services/mojo_media_application.cc @@ -9,14 +9,14 @@ #include "media/base/media_log.h" #include "media/mojo/services/mojo_media_client.h" #include "media/mojo/services/service_factory_impl.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" namespace media { // static -scoped_ptr<mojo::ApplicationDelegate> MojoMediaApplication::CreateApp() { - return scoped_ptr<mojo::ApplicationDelegate>( +scoped_ptr<mojo::ShellClient> MojoMediaApplication::CreateApp() { + return scoped_ptr<mojo::ShellClient>( new MojoMediaApplication(MojoMediaClient::Create())); } @@ -37,14 +37,13 @@ void MojoMediaApplication::Initialize(mojo::Shell* shell, mojo_media_client_->Initialize(); } -bool MojoMediaApplication::AcceptConnection( - mojo::ApplicationConnection* connection) { +bool MojoMediaApplication::AcceptConnection(mojo::Connection* connection) { connection->AddService<interfaces::ServiceFactory>(this); return true; } void MojoMediaApplication::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<interfaces::ServiceFactory> request) { // The created object is owned by the pipe. new ServiceFactoryImpl(std::move(request), connection->GetServiceProvider(), diff --git a/media/mojo/services/mojo_media_application.h b/media/mojo/services/mojo_media_application.h index c3ee1b7..71b1e06 100644 --- a/media/mojo/services/mojo_media_application.h +++ b/media/mojo/services/mojo_media_application.h @@ -4,8 +4,8 @@ #include "base/memory/ref_counted.h" #include "media/mojo/interfaces/service_factory.mojom.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory_impl.h" +#include "mojo/shell/public/cpp/shell_client.h" #include "url/gurl.h" namespace media { @@ -14,23 +14,23 @@ class MediaLog; class MojoMediaClient; class MojoMediaApplication - : public mojo::ApplicationDelegate, + : public mojo::ShellClient, public mojo::InterfaceFactory<interfaces::ServiceFactory> { public: - static scoped_ptr<mojo::ApplicationDelegate> CreateApp(); + static scoped_ptr<mojo::ShellClient> CreateApp(); explicit MojoMediaApplication(scoped_ptr<MojoMediaClient> mojo_media_client); ~MojoMediaApplication() final; private: - // mojo::ApplicationDelegate implementation. + // mojo::ShellClient implementation. void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) final; - bool AcceptConnection(mojo::ApplicationConnection* connection) final; + bool AcceptConnection(mojo::Connection* connection) final; // mojo::InterfaceFactory<interfaces::ServiceFactory> implementation. - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<interfaces::ServiceFactory> request) final; scoped_ptr<MojoMediaClient> mojo_media_client_; diff --git a/media/mojo/services/mojo_renderer_service.h b/media/mojo/services/mojo_renderer_service.h index 78dea69..7c43d3f 100644 --- a/media/mojo/services/mojo_renderer_service.h +++ b/media/mojo/services/mojo_renderer_service.h @@ -17,7 +17,7 @@ #include "mojo/public/cpp/bindings/strong_binding.h" namespace mojo { -class ApplicationConnection; +class Connection; } namespace media { @@ -27,7 +27,7 @@ class CdmContextProvider; class Renderer; // A interfaces::Renderer implementation that uses media::AudioRenderer to -// decode and render audio to a sink obtained from the ApplicationConnection. +// decode and render audio to a sink obtained from the Connection. class MojoRendererService : interfaces::Renderer { public: // |cdm_context_provider| can be used to find the CdmContext to support diff --git a/mojo/mojo_base.gyp b/mojo/mojo_base.gyp index 5667558..f541dcd 100644 --- a/mojo/mojo_base.gyp +++ b/mojo/mojo_base.gyp @@ -225,17 +225,15 @@ 'type': 'static_library', 'sources': [ 'shell/public/cpp/app_lifetime_helper.h', - 'shell/public/cpp/application_connection.h', - 'shell/public/cpp/application_delegate.h', 'shell/public/cpp/application_impl.h', 'shell/public/cpp/application_runner.h', 'shell/public/cpp/connect.h', + 'shell/public/cpp/connection.h', 'shell/public/cpp/initialize_base_and_icu.cc', 'shell/public/cpp/initialize_base_and_icu.h', '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_delegate.cc', 'shell/public/cpp/lib/application_impl.cc', 'shell/public/cpp/lib/application_runner.cc', 'shell/public/cpp/lib/interface_factory_connector.h', @@ -244,9 +242,11 @@ 'shell/public/cpp/lib/service_provider_impl.cc', 'shell/public/cpp/lib/service_registry.cc', 'shell/public/cpp/lib/service_registry.h', - 'shell/public/cpp/shell.h', + 'shell/public/cpp/lib/shell_client.cc', 'shell/public/cpp/service_connector.h', 'shell/public/cpp/service_provider_impl.h', + 'shell/public/cpp/shell.h', + 'shell/public/cpp/shell_client.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 1c6beb4..007a82a 100644 --- a/mojo/public/cpp/bindings/tests/versioning_test_service.cc +++ b/mojo/public/cpp/bindings/tests/versioning_test_service.cc @@ -10,10 +10,9 @@ #include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/public/cpp/system/macros.h" #include "mojo/public/interfaces/bindings/tests/versioning_test_service.mojom.h" -#include "mojo/shell/public/cpp/application_connection.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/application_runner.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace mojo { namespace test { @@ -95,19 +94,19 @@ class HumanResourceDatabaseImpl : public HumanResourceDatabase { }; class HumanResourceSystemServer - : public ApplicationDelegate, + : public ShellClient, public InterfaceFactory<HumanResourceDatabase> { public: HumanResourceSystemServer() {} - // ApplicationDelegate implementation. - bool AcceptConnection(ApplicationConnection* connection) override { + // mojo::ShellClient implementation. + bool AcceptConnection(Connection* connection) override { connection->AddService<HumanResourceDatabase>(this); return true; } // InterfaceFactory<HumanResourceDatabase> implementation. - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<HumanResourceDatabase> request) override { // It will be deleted automatically when the underlying pipe encounters a // connection error. diff --git a/mojo/services/network/http_server_apptest.cc b/mojo/services/network/http_server_apptest.cc index 34f5161..ae1421a 100644 --- a/mojo/services/network/http_server_apptest.cc +++ b/mojo/services/network/http_server_apptest.cc @@ -26,7 +26,6 @@ #include "mojo/services/network/public/interfaces/network_service.mojom.h" #include "mojo/services/network/public/interfaces/web_socket.mojom.h" #include "mojo/services/network/public/interfaces/web_socket_factory.mojom.h" -#include "mojo/shell/public/cpp/application_connection.h" #include "mojo/shell/public/cpp/application_test_base.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" @@ -557,7 +556,7 @@ class HttpServerAppTest : public test::ApplicationTestBase { void SetUp() override { ApplicationTestBase::SetUp(); - scoped_ptr<ApplicationConnection> connection = + scoped_ptr<Connection> connection = shell()->ConnectToApplication("mojo:network_service"); connection->ConnectToService(&network_service_); connection->ConnectToService(&web_socket_factory_); diff --git a/mojo/services/network/mojo_persistent_cookie_store.h b/mojo/services/network/mojo_persistent_cookie_store.h index dd5eecd..97e8b6d 100644 --- a/mojo/services/network/mojo_persistent_cookie_store.h +++ b/mojo/services/network/mojo_persistent_cookie_store.h @@ -20,7 +20,7 @@ namespace mojo { class NetworkServiceDelegate; // A PersistentCookieStore that listens to NetworkContext's and tries to -// gracefully shutdown when our ApplicationConnection is about to be closed. +// gracefully shutdown when our Connection is about to be closed. class MojoPersistentCookieStore : public net::CookieMonster::PersistentCookieStore, public NetworkServiceDelegateObserver { diff --git a/mojo/services/network/network_service_delegate.cc b/mojo/services/network/network_service_delegate.cc index d677f01..8caebfb 100644 --- a/mojo/services/network/network_service_delegate.cc +++ b/mojo/services/network/network_service_delegate.cc @@ -20,7 +20,7 @@ #include "mojo/services/network/network_service_impl.h" #include "mojo/services/network/url_loader_factory_impl.h" #include "mojo/services/network/web_socket_factory_impl.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/util/capture_util.h" #include "sql/mojo/mojo_vfs.h" @@ -131,8 +131,7 @@ void NetworkServiceDelegate::Initialize(Shell* shell, const std::string& url, tracing_.Initialize(shell_, url); } -bool NetworkServiceDelegate::AcceptConnection( - ApplicationConnection* connection) { +bool NetworkServiceDelegate::AcceptConnection(Connection* connection) { DCHECK(context_); connection->AddService<CookieStore>(this); connection->AddService<NetworkService>(this); @@ -155,12 +154,12 @@ void NetworkServiceDelegate::Quit() { context_.reset(); } -void NetworkServiceDelegate::Create(ApplicationConnection* connection, +void NetworkServiceDelegate::Create(Connection* connection, InterfaceRequest<NetworkService> request) { new NetworkServiceImpl(shell_->CreateAppRefCount(), std::move(request)); } -void NetworkServiceDelegate::Create(ApplicationConnection* connection, +void NetworkServiceDelegate::Create(Connection* connection, InterfaceRequest<CookieStore> request) { new CookieStoreImpl( context_.get(), GURL(connection->GetRemoteApplicationURL()).GetOrigin(), @@ -168,14 +167,14 @@ void NetworkServiceDelegate::Create(ApplicationConnection* connection, } void NetworkServiceDelegate::Create( - ApplicationConnection* connection, + Connection* connection, InterfaceRequest<WebSocketFactory> request) { new WebSocketFactoryImpl(context_.get(), shell_->CreateAppRefCount(), std::move(request)); } void NetworkServiceDelegate::Create( - ApplicationConnection* connection, + Connection* connection, InterfaceRequest<URLLoaderFactory> request) { new URLLoaderFactoryImpl(context_.get(), shell_->CreateAppRefCount(), std::move(request)); diff --git a/mojo/services/network/network_service_delegate.h b/mojo/services/network/network_service_delegate.h index 167d983..367eb9a 100644 --- a/mojo/services/network/network_service_delegate.h +++ b/mojo/services/network/network_service_delegate.h @@ -14,9 +14,9 @@ #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h" #include "mojo/services/network/public/interfaces/web_socket_factory.mojom.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory.h" #include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace sql { class ScopedMojoFilesystemVFS; @@ -25,7 +25,7 @@ class ScopedMojoFilesystemVFS; namespace mojo { class NetworkServiceDelegateObserver; -class NetworkServiceDelegate : public ApplicationDelegate, +class NetworkServiceDelegate : public ShellClient, public InterfaceFactory<NetworkService>, public InterfaceFactory<CookieStore>, public InterfaceFactory<WebSocketFactory>, @@ -43,26 +43,26 @@ class NetworkServiceDelegate : public ApplicationDelegate, // multiple times. void EnsureIOThreadShutdown(); - // ApplicationDelegate implementation. + // mojo::ShellClient implementation. void Initialize(Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection(ApplicationConnection* connection) override; + bool AcceptConnection(Connection* connection) override; bool ShellConnectionLost() override; void Quit() override; // InterfaceFactory<NetworkService> implementation. - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<NetworkService> request) override; // InterfaceFactory<CookieStore> implementation. - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<CookieStore> request) override; // InterfaceFactory<WebSocketFactory> implementation. - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<WebSocketFactory> request) override; // InterfaceFactory<URLLoaderFactory> implementation. - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<URLLoaderFactory> request) override; // Overridden from FileSystemClient: diff --git a/mojo/services/network/udp_socket_apptest.cc b/mojo/services/network/udp_socket_apptest.cc index da1634d..dfc7f3c 100644 --- a/mojo/services/network/udp_socket_apptest.cc +++ b/mojo/services/network/udp_socket_apptest.cc @@ -14,7 +14,6 @@ #include "mojo/services/network/public/cpp/udp_socket_wrapper.h" #include "mojo/services/network/public/interfaces/network_service.mojom.h" #include "mojo/services/network/public/interfaces/udp_socket.mojom.h" -#include "mojo/shell/public/cpp/application_connection.h" #include "mojo/shell/public/cpp/application_test_base.h" #include "net/base/net_errors.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/mojo/services/test_service/test_request_tracker_application.cc b/mojo/services/test_service/test_request_tracker_application.cc index cf5d831..4e657cb 100644 --- a/mojo/services/test_service/test_request_tracker_application.cc +++ b/mojo/services/test_service/test_request_tracker_application.cc @@ -9,8 +9,8 @@ #include "mojo/public/c/system/main.h" #include "mojo/services/test_service/test_time_service_impl.h" -#include "mojo/shell/public/cpp/application_connection.h" #include "mojo/shell/public/cpp/application_runner.h" +#include "mojo/shell/public/cpp/connection.h" namespace mojo { namespace test { @@ -25,8 +25,7 @@ void TestRequestTrackerApplication::Initialize(Shell* shell, shell_ = shell; } -bool TestRequestTrackerApplication::AcceptConnection( - ApplicationConnection* connection) { +bool TestRequestTrackerApplication::AcceptConnection(Connection* connection) { // Every instance of the service and recorder shares the context. // Note, this app is single-threaded, so this is thread safe. connection->AddService<TestTimeService>(this); @@ -36,19 +35,19 @@ bool TestRequestTrackerApplication::AcceptConnection( } void TestRequestTrackerApplication::Create( - ApplicationConnection* connection, + Connection* connection, InterfaceRequest<TestTimeService> request) { new TestTimeServiceImpl(shell_, std::move(request)); } void TestRequestTrackerApplication::Create( - ApplicationConnection* connection, + Connection* connection, InterfaceRequest<TestRequestTracker> request) { new TestRequestTrackerImpl(std::move(request), &context_); } void TestRequestTrackerApplication::Create( - ApplicationConnection* connection, + Connection* connection, InterfaceRequest<TestTrackedRequestService> request) { new TestTrackedRequestServiceImpl(std::move(request), &context_); } diff --git a/mojo/services/test_service/test_request_tracker_application.h b/mojo/services/test_service/test_request_tracker_application.h index 8d7f84c..74aa39c 100644 --- a/mojo/services/test_service/test_request_tracker_application.h +++ b/mojo/services/test_service/test_request_tracker_application.h @@ -7,8 +7,8 @@ #include "mojo/public/cpp/system/macros.h" #include "mojo/services/test_service/test_request_tracker_impl.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory_impl.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace mojo { class ApplicationImpl; @@ -17,7 +17,7 @@ class TestTimeService; // Embeds TestRequestTracker mojo services into an application. class TestRequestTrackerApplication - : public ApplicationDelegate, + : public ShellClient, public InterfaceFactory<TestTimeService>, public InterfaceFactory<TestRequestTracker>, public InterfaceFactory<TestTrackedRequestService> { @@ -25,20 +25,20 @@ class TestRequestTrackerApplication TestRequestTrackerApplication(); ~TestRequestTrackerApplication() override; - // ApplicationDelegate methods: + // mojo::ShellClient methods: void Initialize(Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection(ApplicationConnection* connection) override; + bool AcceptConnection(Connection* connection) override; // InterfaceFactory<TestTimeService> methods: - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<TestTimeService> request) override; // InterfaceFactory<TestRequestTracker> methods: - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<TestRequestTracker> request) override; // InterfaceFactory<TestTrackedRequestService> methods: - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<TestTrackedRequestService> request) override; private: diff --git a/mojo/services/test_service/test_request_tracker_impl.h b/mojo/services/test_service/test_request_tracker_impl.h index 5251e57..97fd864 100644 --- a/mojo/services/test_service/test_request_tracker_impl.h +++ b/mojo/services/test_service/test_request_tracker_impl.h @@ -13,7 +13,6 @@ #include "mojo/services/test_service/test_request_tracker.mojom.h" namespace mojo { -class ApplicationConnection; namespace test { typedef std::map<uint64_t, std::vector<ServiceStats> > AllRecordsMap; diff --git a/mojo/services/test_service/test_service_application.cc b/mojo/services/test_service/test_service_application.cc index 0f82eb9..940ce60 100644 --- a/mojo/services/test_service/test_service_application.cc +++ b/mojo/services/test_service/test_service_application.cc @@ -10,8 +10,8 @@ #include "mojo/public/c/system/main.h" #include "mojo/services/test_service/test_service_impl.h" #include "mojo/services/test_service/test_time_service_impl.h" -#include "mojo/shell/public/cpp/application_connection.h" #include "mojo/shell/public/cpp/application_runner.h" +#include "mojo/shell/public/cpp/connection.h" namespace mojo { namespace test { @@ -28,20 +28,19 @@ void TestServiceApplication::Initialize(Shell* shell, const std::string& url, shell_ = shell; } -bool TestServiceApplication::AcceptConnection( - ApplicationConnection* connection) { +bool TestServiceApplication::AcceptConnection(Connection* connection) { connection->AddService<TestService>(this); connection->AddService<TestTimeService>(this); return true; } -void TestServiceApplication::Create(ApplicationConnection* connection, +void TestServiceApplication::Create(Connection* connection, InterfaceRequest<TestService> request) { new TestServiceImpl(shell_, this, std::move(request)); AddRef(); } -void TestServiceApplication::Create(ApplicationConnection* connection, +void TestServiceApplication::Create(Connection* connection, InterfaceRequest<TestTimeService> request) { new TestTimeServiceImpl(shell_, std::move(request)); } diff --git a/mojo/services/test_service/test_service_application.h b/mojo/services/test_service/test_service_application.h index e4a527a..fd107fb 100644 --- a/mojo/services/test_service/test_service_application.h +++ b/mojo/services/test_service/test_service_application.h @@ -6,33 +6,32 @@ #define SERVICES_TEST_SERVICE_TEST_SERVICE_APPLICATION_H_ #include "mojo/public/cpp/system/macros.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace mojo { -class ApplicationConnection; - +class Connection; namespace test { class TestService; class TestTimeService; -class TestServiceApplication : public ApplicationDelegate, +class TestServiceApplication : public ShellClient, public InterfaceFactory<TestService>, public InterfaceFactory<TestTimeService> { public: TestServiceApplication(); ~TestServiceApplication() override; - // ApplicationDelegate implementation. + // mojo::ShellClient implementation. void Initialize(Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection(ApplicationConnection* connection) override; + bool AcceptConnection(Connection* connection) override; // InterfaceFactory<TestService> implementation. - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<TestService> request) override; // InterfaceFactory<TestTimeService> implementation. - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<TestTimeService> request) override; void AddRef(); diff --git a/mojo/services/test_service/test_time_service_impl.h b/mojo/services/test_service/test_time_service_impl.h index ead6899..6b50982 100644 --- a/mojo/services/test_service/test_time_service_impl.h +++ b/mojo/services/test_service/test_time_service_impl.h @@ -14,8 +14,7 @@ #include "mojo/services/test_service/test_service.mojom.h" namespace mojo { - -class ApplicationConnection; +class Connection; class Shell; namespace test { diff --git a/mojo/services/tracing/public/cpp/trace_provider_impl.cc b/mojo/services/tracing/public/cpp/trace_provider_impl.cc index d4ff597..12842e5 100644 --- a/mojo/services/tracing/public/cpp/trace_provider_impl.cc +++ b/mojo/services/tracing/public/cpp/trace_provider_impl.cc @@ -12,7 +12,7 @@ #include "base/time/time.h" #include "base/trace_event/trace_config.h" #include "base/trace_event/trace_event.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" namespace mojo { diff --git a/mojo/services/tracing/public/cpp/tracing_impl.cc b/mojo/services/tracing/public/cpp/tracing_impl.cc index 04cd7d15..a340f75 100644 --- a/mojo/services/tracing/public/cpp/tracing_impl.cc +++ b/mojo/services/tracing/public/cpp/tracing_impl.cc @@ -66,7 +66,7 @@ void TracingImpl::Initialize(Shell* shell, const std::string& url) { #endif } -void TracingImpl::Create(ApplicationConnection* connection, +void TracingImpl::Create(Connection* connection, InterfaceRequest<tracing::TraceProvider> request) { provider_impl_.Bind(std::move(request)); } diff --git a/mojo/services/tracing/public/cpp/tracing_impl.h b/mojo/services/tracing/public/cpp/tracing_impl.h index 97db143..42d0a74 100644 --- a/mojo/services/tracing/public/cpp/tracing_impl.h +++ b/mojo/services/tracing/public/cpp/tracing_impl.h @@ -12,7 +12,7 @@ namespace mojo { -class ApplicationConnection; +class Connection; class Shell; // Connects to mojo:tracing during your Application's Initialize() call once @@ -36,10 +36,10 @@ class TracingImpl : public InterfaceFactory<tracing::TraceProvider> { private: // InterfaceFactory<tracing::TraceProvider> implementation. - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<tracing::TraceProvider> request) override; - scoped_ptr<ApplicationConnection> connection_; + scoped_ptr<Connection> connection_; TraceProviderImpl provider_impl_; DISALLOW_COPY_AND_ASSIGN(TracingImpl); diff --git a/mojo/services/tracing/tracing_app.cc b/mojo/services/tracing/tracing_app.cc index 13829b6..09d1f3b 100644 --- a/mojo/services/tracing/tracing_app.cc +++ b/mojo/services/tracing/tracing_app.cc @@ -12,7 +12,6 @@ #include "base/bind.h" #include "base/logging.h" #include "base/message_loop/message_loop.h" -#include "mojo/shell/public/cpp/application_connection.h" namespace tracing { @@ -22,8 +21,7 @@ TracingApp::TracingApp() : collector_binding_(this), tracing_active_(false) { TracingApp::~TracingApp() { } -bool TracingApp::AcceptConnection( - mojo::ApplicationConnection* connection) { +bool TracingApp::AcceptConnection(mojo::Connection* connection) { connection->AddService<TraceCollector>(this); connection->AddService<StartupPerformanceDataCollector>(this); @@ -44,13 +42,13 @@ bool TracingApp::AcceptConnection( return true; } -void TracingApp::Create(mojo::ApplicationConnection* connection, +void TracingApp::Create(mojo::Connection* connection, mojo::InterfaceRequest<TraceCollector> request) { collector_binding_.Bind(std::move(request)); } void TracingApp::Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<StartupPerformanceDataCollector> request) { startup_performance_data_collector_bindings_.AddBinding(this, std::move(request)); diff --git a/mojo/services/tracing/tracing_app.h b/mojo/services/tracing/tracing_app.h index d7b19dc..8f14dcb9 100644 --- a/mojo/services/tracing/tracing_app.h +++ b/mojo/services/tracing/tracing_app.h @@ -16,13 +16,13 @@ #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" #include "mojo/services/tracing/trace_data_sink.h" #include "mojo/services/tracing/trace_recorder_impl.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace tracing { class TracingApp - : public mojo::ApplicationDelegate, + : public mojo::ShellClient, public mojo::InterfaceFactory<TraceCollector>, public TraceCollector, public mojo::InterfaceFactory<StartupPerformanceDataCollector>, @@ -32,17 +32,16 @@ class TracingApp ~TracingApp() override; private: - // mojo::ApplicationDelegate implementation. - bool AcceptConnection( - mojo::ApplicationConnection* connection) override; + // mojo::ShellClient implementation. + bool AcceptConnection(mojo::Connection* connection) override; // mojo::InterfaceFactory<TraceCollector> implementation. - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<TraceCollector> request) override; // mojo::InterfaceFactory<StartupPerformanceDataCollector> implementation. void Create( - mojo::ApplicationConnection* connection, + mojo::Connection* connection, mojo::InterfaceRequest<StartupPerformanceDataCollector> request) override; // tracing::TraceCollector implementation. diff --git a/mojo/shell/application_manager_apptest.cc b/mojo/shell/application_manager_apptest.cc index fb6517e..5091d45 100644 --- a/mojo/shell/application_manager_apptest.cc +++ b/mojo/shell/application_manager_apptest.cc @@ -26,7 +26,7 @@ namespace shell { namespace { class ApplicationManagerAppTestDelegate - : public ApplicationDelegate, + : public ShellClient, public InterfaceFactory<CreateInstanceForHandleTest>, public CreateInstanceForHandleTest { public: @@ -38,17 +38,16 @@ class ApplicationManagerAppTestDelegate uint32_t target_id() const { return target_id_; } private: - // ApplicationDelegate: + // mojo::ShellClient: void Initialize(Shell* shell, const std::string& url, uint32_t id) override {} - bool AcceptConnection(ApplicationConnection* connection) override { + bool AcceptConnection(Connection* connection) override { connection->AddService<CreateInstanceForHandleTest>(this); return true; } // InterfaceFactory<CreateInstanceForHandleTest>: - void Create( - ApplicationConnection* connection, - InterfaceRequest<CreateInstanceForHandleTest> request) override { + void Create(Connection* connection, + InterfaceRequest<CreateInstanceForHandleTest> request) override { binding_.Bind(std::move(request)); } @@ -123,7 +122,7 @@ class ApplicationManagerAppTest : public mojo::test::ApplicationTestBase, private: // test::ApplicationTestBase: - ApplicationDelegate* GetApplicationDelegate() override { + ShellClient* GetShellClient() override { delegate_ = new ApplicationManagerAppTestDelegate; return delegate_; } @@ -174,7 +173,7 @@ TEST_F(ApplicationManagerAppTest, CreateInstanceForHandle) { // 1. Launch a process. (Actually, have the runner launch a process that // launches a process. #becauselinkerrors). mojo::shell::test::mojom::DriverPtr driver; - scoped_ptr<ApplicationConnection> connection = + scoped_ptr<Connection> connection = shell()->ConnectToApplication("exe:application_manager_apptest_driver"); connection->ConnectToService(&driver); diff --git a/mojo/shell/application_manager_apptest_driver.cc b/mojo/shell/application_manager_apptest_driver.cc index 3b575f5..2bd0de3 100644 --- a/mojo/shell/application_manager_apptest_driver.cc +++ b/mojo/shell/application_manager_apptest_driver.cc @@ -24,10 +24,10 @@ #include "mojo/edk/embedder/platform_channel_pair.h" #include "mojo/edk/embedder/scoped_platform_handle.h" #include "mojo/shell/application_manager_apptests.mojom.h" -#include "mojo/shell/public/cpp/application_connection.h" -#include "mojo/shell/public/cpp/application_delegate.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/interface_factory.h" #include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/shell_client.h" #include "mojo/shell/public/interfaces/application_manager.mojom.h" #include "mojo/shell/runner/child/test_native_main.h" #include "mojo/shell/runner/common/switches.h" @@ -38,7 +38,7 @@ using mojo::shell::test::mojom::Driver; namespace { -class TargetApplicationDelegate : public mojo::ApplicationDelegate, +class TargetApplicationDelegate : public mojo::ShellClient, public mojo::InterfaceFactory<Driver>, public Driver { public: @@ -46,7 +46,7 @@ class TargetApplicationDelegate : public mojo::ApplicationDelegate, ~TargetApplicationDelegate() override {} private: - // mojo::ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override { shell_ = shell; @@ -110,13 +110,13 @@ class TargetApplicationDelegate : public mojo::ApplicationDelegate, platform_channel_pair.PassServerHandle()); } - bool AcceptConnection(mojo::ApplicationConnection* connection) override { + bool AcceptConnection(mojo::Connection* connection) override { connection->AddService<Driver>(this); return true; } // mojo::InterfaceFactory<Driver>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<Driver> request) override { bindings_.AddBinding(this, std::move(request)); } diff --git a/mojo/shell/application_manager_apptest_target.cc b/mojo/shell/application_manager_apptest_target.cc index 2467608..e0c23b8 100644 --- a/mojo/shell/application_manager_apptest_target.cc +++ b/mojo/shell/application_manager_apptest_target.cc @@ -6,9 +6,9 @@ #include "base/command_line.h" #include "base/macros.h" #include "mojo/shell/application_manager_apptests.mojom.h" -#include "mojo/shell/public/cpp/application_connection.h" -#include "mojo/shell/public/cpp/application_delegate.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/shell_client.h" #include "mojo/shell/runner/child/test_native_main.h" #include "mojo/shell/runner/init.h" @@ -16,13 +16,13 @@ using mojo::shell::test::mojom::CreateInstanceForHandleTestPtr; namespace { -class TargetApplicationDelegate : public mojo::ApplicationDelegate { +class TargetApplicationDelegate : public mojo::ShellClient { public: TargetApplicationDelegate() {} ~TargetApplicationDelegate() override {} private: - // mojo::ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override { CreateInstanceForHandleTestPtr service; diff --git a/mojo/shell/application_manager_unittest.cc b/mojo/shell/application_manager_unittest.cc index 94b92c6..a673347 100644 --- a/mojo/shell/application_manager_unittest.cc +++ b/mojo/shell/application_manager_unittest.cc @@ -17,10 +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_connection.h" -#include "mojo/shell/public/cpp/application_delegate.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/interfaces/service_provider.mojom.h" #include "mojo/shell/test.mojom.h" #include "mojo/shell/test_package_manager.h" @@ -95,7 +94,7 @@ class TestClient { }; class TestApplicationLoader : public ApplicationLoader, - public ApplicationDelegate, + public ShellClient, public InterfaceFactory<TestService> { public: TestApplicationLoader() @@ -119,15 +118,15 @@ class TestApplicationLoader : public ApplicationLoader, test_app_.reset(new ApplicationImpl(this, std::move(application_request))); } - // ApplicationDelegate implementation. - bool AcceptConnection(ApplicationConnection* connection) override { + // mojo::ShellClient implementation. + bool AcceptConnection(Connection* connection) override { connection->AddService<TestService>(this); last_requestor_url_ = GURL(connection->GetRemoteApplicationURL()); return true; } // InterfaceFactory<TestService> implementation. - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<TestService> request) override { new TestServiceImpl(context_, std::move(request)); } @@ -277,7 +276,7 @@ class TestAImpl : public TestA { test_context_->QuitSoon(); } - scoped_ptr<ApplicationConnection> connection_; + scoped_ptr<Connection> connection_; TesterContext* test_context_; TestBPtr b_; StrongBinding<TestA> binding_; @@ -285,7 +284,7 @@ class TestAImpl : public TestA { class TestBImpl : public TestB { public: - TestBImpl(ApplicationConnection* connection, + TestBImpl(Connection* connection, TesterContext* test_context, InterfaceRequest<TestB> request) : test_context_(test_context), binding_(this, std::move(request)) { @@ -317,7 +316,7 @@ class TestBImpl : public TestB { class TestCImpl : public TestC { public: - TestCImpl(ApplicationConnection* connection, + TestCImpl(Connection* connection, TesterContext* test_context, InterfaceRequest<TestC> request) : test_context_(test_context), binding_(this, std::move(request)) {} @@ -334,7 +333,7 @@ class TestCImpl : public TestC { StrongBinding<TestC> binding_; }; -class Tester : public ApplicationDelegate, +class Tester : public ShellClient, public ApplicationLoader, public InterfaceFactory<TestA>, public InterfaceFactory<TestB>, @@ -350,7 +349,7 @@ class Tester : public ApplicationDelegate, app_.reset(new ApplicationImpl(this, std::move(application_request))); } - bool AcceptConnection(ApplicationConnection* connection) override { + bool AcceptConnection(Connection* connection) override { if (!requestor_url_.empty() && requestor_url_ != connection->GetRemoteApplicationURL()) { context_->set_tester_called_quit(); @@ -366,18 +365,18 @@ class Tester : public ApplicationDelegate, return true; } - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<TestA> request) override { a_bindings_.push_back( new TestAImpl(app_.get(), context_, std::move(request), this)); } - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<TestB> request) override { new TestBImpl(connection, context_, std::move(request)); } - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<TestC> request) override { new TestCImpl(connection, context_, std::move(request)); } diff --git a/mojo/shell/application_package_apptest.cc b/mojo/shell/application_package_apptest.cc index 981f245..3d19daf 100644 --- a/mojo/shell/application_package_apptest.cc +++ b/mojo/shell/application_package_apptest.cc @@ -30,7 +30,7 @@ using GetNameCallback = test::mojom::ApplicationPackageApptestService::GetNameCallback; class ProvidedApplicationDelegate - : public ApplicationDelegate, + : public ShellClient, public InterfaceFactory<test::mojom::ApplicationPackageApptestService>, public test::mojom::ApplicationPackageApptestService, public base::SimpleThread { @@ -50,16 +50,16 @@ class ProvidedApplicationDelegate } private: - // ApplicationDelegate: + // mojo::ShellClient: void Initialize(Shell* shell, const std::string& url, uint32_t id) override {} - bool AcceptConnection(ApplicationConnection* connection) override { + bool AcceptConnection(Connection* connection) override { connection->AddService<test::mojom::ApplicationPackageApptestService>(this); return true; } // InterfaceFactory<test::mojom::ApplicationPackageApptestService>: void Create( - ApplicationConnection* connection, + Connection* connection, InterfaceRequest<test::mojom::ApplicationPackageApptestService> request) override { bindings_.AddBinding(this, std::move(request)); @@ -86,7 +86,7 @@ class ProvidedApplicationDelegate }; class ApplicationPackageApptestDelegate - : public ApplicationDelegate, + : public ShellClient, public InterfaceFactory<mojom::ContentHandler>, public InterfaceFactory<test::mojom::ApplicationPackageApptestService>, public mojom::ContentHandler, @@ -96,22 +96,22 @@ class ApplicationPackageApptestDelegate ~ApplicationPackageApptestDelegate() override {} private: - // ApplicationDelegate: + // mojo::ShellClient: void Initialize(Shell* shell, const std::string& url, uint32_t id) override {} - bool AcceptConnection(ApplicationConnection* connection) override { + bool AcceptConnection(Connection* connection) override { connection->AddService<ContentHandler>(this); connection->AddService<test::mojom::ApplicationPackageApptestService>(this); return true; } // InterfaceFactory<mojom::ContentHandler>: - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<mojom::ContentHandler> request) override { content_handler_bindings_.AddBinding(this, std::move(request)); } // InterfaceFactory<test::mojom::ApplicationPackageApptestService>: - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<test::mojom::ApplicationPackageApptestService> request) override { bindings_.AddBinding(this, std::move(request)); @@ -136,7 +136,7 @@ class ApplicationPackageApptestDelegate callback.Run("ROOT"); } - std::vector<scoped_ptr<ApplicationDelegate>> delegates_; + std::vector<scoped_ptr<ShellClient>> delegates_; WeakBindingSet<mojom::ContentHandler> content_handler_bindings_; WeakBindingSet<test::mojom::ApplicationPackageApptestService> bindings_; @@ -159,7 +159,7 @@ class ApplicationPackageApptest : public mojo::test::ApplicationTestBase { private: // test::ApplicationTestBase: - ApplicationDelegate* GetApplicationDelegate() override { + ShellClient* GetShellClient() override { delegate_ = new ApplicationPackageApptestDelegate; return delegate_; } diff --git a/mojo/shell/capability_filter_test.cc b/mojo/shell/capability_filter_test.cc index 8363bcb..4717bb6 100644 --- a/mojo/shell/capability_filter_test.cc +++ b/mojo/shell/capability_filter_test.cc @@ -13,9 +13,8 @@ #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_connection.h" #include "mojo/shell/public/cpp/application_impl.h" -#include "mojo/shell/public/cpp/connect.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/interface_factory.h" #include "mojo/shell/public/cpp/service_provider_impl.h" @@ -27,7 +26,7 @@ namespace test { // Listens for services exposed/blocked and for application connections being // closed. Quits |loop| when all expectations are met. class ConnectionValidator : public ApplicationLoader, - public ApplicationDelegate, + public ShellClient, public InterfaceFactory<Validator>, public Validator { public: @@ -56,14 +55,14 @@ class ConnectionValidator : public ApplicationLoader, app_.reset(new ApplicationImpl(this, std::move(request))); } - // Overridden from ApplicationDelegate: - bool AcceptConnection(ApplicationConnection* connection) override { + // Overridden from ShellClient: + bool AcceptConnection(Connection* connection) override { connection->AddService<Validator>(this); return true; } // Overridden from InterfaceFactory<Validator>: - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<Validator> request) override { validator_bindings_.AddBinding(this, std::move(request)); } @@ -107,7 +106,7 @@ class ConnectionValidator : public ApplicationLoader, // This class models a system service that exposes two interfaces, Safe and // Unsafe. The interface Unsafe is not to be exposed to untrusted applications. -class ServiceApplication : public ApplicationDelegate, +class ServiceApplication : public ShellClient, public InterfaceFactory<Safe>, public InterfaceFactory<Unsafe>, public Safe, @@ -117,33 +116,33 @@ class ServiceApplication : public ApplicationDelegate, ~ServiceApplication() override {} private: - // Overridden from ApplicationDelegate: + // Overridden from ShellClient: void Initialize(Shell* shell, const std::string& url, uint32_t id) override { shell_ = shell; // ServiceApplications have no capability filter and can thus connect // directly to the validator application. shell_->ConnectToService("test:validator", &validator_); } - bool AcceptConnection(ApplicationConnection* connection) override { + bool AcceptConnection(Connection* connection) override { AddService<Safe>(connection); AddService<Unsafe>(connection); return true; } // Overridden from InterfaceFactory<Safe>: - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<Safe> request) override { safe_bindings_.AddBinding(this, std::move(request)); } // Overridden from InterfaceFactory<Unsafe>: - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<Unsafe> request) override { unsafe_bindings_.AddBinding(this, std::move(request)); } template <typename Interface> - void AddService(ApplicationConnection* connection) { + void AddService(Connection* connection) { validator_->AddServiceCalled(connection->GetRemoteApplicationURL(), connection->GetConnectionURL(), Interface::Name_, @@ -169,8 +168,7 @@ void TestApplication::Initialize(Shell* shell, const std::string& url, shell_ = shell; url_ = url; } -bool TestApplication::AcceptConnection( - ApplicationConnection* connection) { +bool TestApplication::AcceptConnection(Connection* connection) { // TestApplications receive their Validator via the inbound connection. connection->ConnectToService(&validator_); @@ -193,7 +191,7 @@ void TestApplication::ConnectionClosed(const std::string& service_url) { //////////////////////////////////////////////////////////////////////////////// // TestLoader: -TestLoader::TestLoader(ApplicationDelegate* delegate) : delegate_(delegate) {} +TestLoader::TestLoader(ShellClient* delegate) : delegate_(delegate) {} TestLoader::~TestLoader() {} void TestLoader::Load(const GURL& url, diff --git a/mojo/shell/capability_filter_test.h b/mojo/shell/capability_filter_test.h index 459cfe8..9052d18 100644 --- a/mojo/shell/capability_filter_test.h +++ b/mojo/shell/capability_filter_test.h @@ -9,7 +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_delegate.h" +#include "mojo/shell/public/cpp/application_impl.h" +#include "mojo/shell/public/cpp/shell_client.h" #include "testing/gtest/include/gtest/gtest.h" namespace mojo { @@ -21,30 +22,30 @@ class ConnectionValidator; // This class models an application who will use the shell to interact with a // system service. The shell may limit this application's visibility of the full // set of interfaces exposed by that service. -class TestApplication : public ApplicationDelegate { +class TestApplication : public ShellClient { public: TestApplication(); ~TestApplication() override; private: - // Overridden from ApplicationDelegate: + // Overridden from ShellClient: void Initialize(Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection(ApplicationConnection* connection) override; + bool AcceptConnection(Connection* connection) override; void ConnectionClosed(const std::string& service_url); Shell* shell_; std::string url_; ValidatorPtr validator_; - scoped_ptr<ApplicationConnection> connection1_; - scoped_ptr<ApplicationConnection> connection2_; + scoped_ptr<Connection> connection1_; + scoped_ptr<Connection> connection2_; DISALLOW_COPY_AND_ASSIGN(TestApplication); }; class TestLoader : public ApplicationLoader { public: - explicit TestLoader(ApplicationDelegate* delegate); + explicit TestLoader(ShellClient* delegate); ~TestLoader() override; private: @@ -52,7 +53,7 @@ class TestLoader : public ApplicationLoader { void Load(const GURL& url, InterfaceRequest<mojom::Application> request) override; - scoped_ptr<ApplicationDelegate> delegate_; + scoped_ptr<ShellClient> delegate_; scoped_ptr<ApplicationImpl> app_; DISALLOW_COPY_AND_ASSIGN(TestLoader); @@ -93,8 +94,8 @@ class CapabilityFilterTest : public testing::Test { void RunTest(); template<class T> - scoped_ptr<ApplicationDelegate> CreateApplicationDelegate() { - return scoped_ptr<ApplicationDelegate>(new T); + scoped_ptr<ShellClient> CreateShellClient() { + return scoped_ptr<ShellClient>(new T); } base::ShadowingAtExitManager at_exit_; diff --git a/mojo/shell/fetcher/about_fetcher_unittest.cc b/mojo/shell/fetcher/about_fetcher_unittest.cc index a280525..b9e6046 100644 --- a/mojo/shell/fetcher/about_fetcher_unittest.cc +++ b/mojo/shell/fetcher/about_fetcher_unittest.cc @@ -18,10 +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_connection.h" -#include "mojo/shell/public/cpp/application_delegate.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/interfaces/content_handler.mojom.h" #include "mojo/util/filename_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -30,7 +29,7 @@ namespace mojo { namespace shell { namespace { -class TestContentHandler : public ApplicationDelegate, +class TestContentHandler : public ShellClient, public InterfaceFactory<mojom::ContentHandler>, public mojom::ContentHandler { public: @@ -41,15 +40,15 @@ class TestContentHandler : public ApplicationDelegate, const URLResponse* latest_response() const { return latest_response_.get(); } private: - // Overridden from ApplicationDelegate: + // Overridden from ShellClient: void Initialize(Shell* shell, const std::string& url, uint32_t id) override {} - bool AcceptConnection(ApplicationConnection* connection) override { + bool AcceptConnection(Connection* connection) override { connection->AddService<mojom::ContentHandler>(this); return true; } // Overridden from InterfaceFactory<mojom::ContentHandler>: - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<mojom::ContentHandler> request) override { bindings_.AddBinding(this, std::move(request)); } @@ -79,7 +78,7 @@ class TestContentHandler : public ApplicationDelegate, class TestLoader : public ApplicationLoader { public: - explicit TestLoader(ApplicationDelegate* delegate) : delegate_(delegate) {} + explicit TestLoader(ShellClient* delegate) : delegate_(delegate) {} ~TestLoader() override {} private: @@ -89,7 +88,7 @@ class TestLoader : public ApplicationLoader { app_.reset(new ApplicationImpl(delegate_, std::move(request))); } - ApplicationDelegate* delegate_; + ShellClient* delegate_; scoped_ptr<ApplicationImpl> app_; DISALLOW_COPY_AND_ASSIGN(TestLoader); 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 7e9ace8..fe88fe9 100644 --- a/mojo/shell/package_manager/capability_filter_content_handler_unittest.cc +++ b/mojo/shell/package_manager/capability_filter_content_handler_unittest.cc @@ -12,10 +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_connection.h" -#include "mojo/shell/public/cpp/application_delegate.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/interfaces/content_handler.mojom.h" #include "testing/gtest/include/gtest/gtest.h" @@ -77,7 +76,7 @@ class TestPackageManager : public PackageManagerImpl { DISALLOW_COPY_AND_ASSIGN(TestPackageManager); }; -class TestContentHandler : public ApplicationDelegate, +class TestContentHandler : public ShellClient, public InterfaceFactory<mojom::ContentHandler>, public mojom::ContentHandler { public: @@ -85,15 +84,15 @@ class TestContentHandler : public ApplicationDelegate, ~TestContentHandler() override {} private: - // Overridden from ApplicationDelegate: + // Overridden from ShellClient: void Initialize(Shell* shell, const std::string& url, uint32_t id) override {} - bool AcceptConnection(ApplicationConnection* connection) override { + bool AcceptConnection(Connection* connection) override { connection->AddService<mojom::ContentHandler>(this); return true; } // Overridden from InterfaceFactory<mojom::ContentHandler>: - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<mojom::ContentHandler> request) override { bindings_.AddBinding(this, std::move(request)); } @@ -103,7 +102,7 @@ class TestContentHandler : public ApplicationDelegate, InterfaceRequest<mojom::Application> application, URLResponsePtr response, const Callback<void()>& destruct_callback) override { - scoped_ptr<ApplicationDelegate> delegate(new test::TestApplication); + scoped_ptr<ShellClient> delegate(new test::TestApplication); embedded_apps_.push_back( new ApplicationImpl(delegate.get(), std::move(application))); embedded_app_delegates_.push_back(std::move(delegate)); @@ -111,7 +110,7 @@ class TestContentHandler : public ApplicationDelegate, } WeakBindingSet<mojom::ContentHandler> bindings_; - ScopedVector<ApplicationDelegate> embedded_app_delegates_; + ScopedVector<ShellClient> embedded_app_delegates_; ScopedVector<ApplicationImpl> embedded_apps_; DISALLOW_COPY_AND_ASSIGN(TestContentHandler); diff --git a/mojo/shell/package_manager/content_handler_unittest.cc b/mojo/shell/package_manager/content_handler_unittest.cc index 95870f3..4d743af 100644 --- a/mojo/shell/package_manager/content_handler_unittest.cc +++ b/mojo/shell/package_manager/content_handler_unittest.cc @@ -19,10 +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_connection.h" -#include "mojo/shell/public/cpp/application_delegate.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/interfaces/content_handler.mojom.h" #include "mojo/shell/public/interfaces/service_provider.mojom.h" #include "mojo/shell/test_package_manager.h" @@ -73,9 +72,9 @@ void QuitClosure(bool* value) { } class TestContentHandler : public mojom::ContentHandler, - public ApplicationDelegate { + public ShellClient{ public: - TestContentHandler(ApplicationConnection* connection, + TestContentHandler(Connection* connection, InterfaceRequest<mojom::ContentHandler> request) : binding_(this, std::move(request)) {} @@ -96,7 +95,7 @@ class TestContentHandler : public mojom::ContentHandler, }; class TestApplicationLoader : public ApplicationLoader, - public ApplicationDelegate, + public ShellClient, public InterfaceFactory<mojom::ContentHandler> { public: TestApplicationLoader() : num_loads_(0) {} @@ -113,14 +112,14 @@ class TestApplicationLoader : public ApplicationLoader, test_app_.reset(new ApplicationImpl(this, std::move(application_request))); } - // ApplicationDelegate implementation. - bool AcceptConnection(ApplicationConnection* connection) override { + // mojo::ShellClient implementation. + bool AcceptConnection(Connection* connection) override { connection->AddService<mojom::ContentHandler>(this); last_requestor_url_ = GURL(connection->GetRemoteApplicationURL()); return true; } // InterfaceFactory<mojom::ContentHandler> implementation. - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<mojom::ContentHandler> request) override { new TestContentHandler(connection, std::move(request)); } diff --git a/mojo/shell/public/cpp/BUILD.gn b/mojo/shell/public/cpp/BUILD.gn index 81da818..1d8ad18 100644 --- a/mojo/shell/public/cpp/BUILD.gn +++ b/mojo/shell/public/cpp/BUILD.gn @@ -21,16 +21,14 @@ source_set("cpp_for_chromium") { source_set("sources") { sources = [ "app_lifetime_helper.h", - "application_connection.h", - "application_delegate.h", "application_impl.h", "application_runner.h", "connect.h", + "connection.h", "initialize_base_and_icu.cc", "interface_factory.h", "interface_factory_impl.h", "lib/app_lifetime_helper.cc", - "lib/application_delegate.cc", "lib/application_impl.cc", "lib/application_runner.cc", "lib/interface_factory_connector.h", @@ -39,9 +37,11 @@ source_set("sources") { "lib/service_provider_impl.cc", "lib/service_registry.cc", "lib/service_registry.h", + "lib/shell_client.cc", "service_connector.h", "service_provider_impl.h", "shell.h", + "shell_client.h", ] deps = [ diff --git a/mojo/shell/public/cpp/application_impl.h b/mojo/shell/public/cpp/application_impl.h index 18d82d4..5ade99f 100644 --- a/mojo/shell/public/cpp/application_impl.h +++ b/mojo/shell/public/cpp/application_impl.h @@ -15,10 +15,9 @@ #include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/system/core.h" #include "mojo/shell/public/cpp/app_lifetime_helper.h" -#include "mojo/shell/public/cpp/application_connection.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/lib/service_registry.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" @@ -77,12 +76,12 @@ class ApplicationImpl : public Shell, public shell::mojom::Application { // Does not take ownership of |delegate|, which must remain valid for the // lifetime of ApplicationImpl. - ApplicationImpl(ApplicationDelegate* delegate, + ApplicationImpl(ShellClient* client, InterfaceRequest<shell::mojom::Application> request); // Constructs an ApplicationImpl with a custom termination closure. This // closure is invoked on Quit() instead of the default behavior of quitting // the current base::MessageLoop. - ApplicationImpl(ApplicationDelegate* delegate, + ApplicationImpl(ShellClient* client, InterfaceRequest<shell::mojom::Application> request, const Closure& termination_closure); ~ApplicationImpl() override; @@ -97,10 +96,8 @@ class ApplicationImpl : public Shell, public shell::mojom::Application { void WaitForInitialize(); // Shell. - scoped_ptr<ApplicationConnection> ConnectToApplication( - const std::string& url) override; - scoped_ptr<ApplicationConnection> ConnectToApplication( - ConnectParams* params) override; + scoped_ptr<Connection> ConnectToApplication(const std::string& url) override; + scoped_ptr<Connection> ConnectToApplication(ConnectParams* params) override; void Quit() override; scoped_ptr<AppRefCount> CreateAppRefCount() override; @@ -132,8 +129,8 @@ class ApplicationImpl : public Shell, public shell::mojom::Application { // We track the lifetime of incoming connection registries as it more // convenient for the client. - ScopedVector<ApplicationConnection> incoming_connections_; - ApplicationDelegate* delegate_; + ScopedVector<Connection> incoming_connections_; + ShellClient* client_; Binding<shell::mojom::Application> binding_; shell::mojom::ShellPtr shell_; Closure termination_closure_; diff --git a/mojo/shell/public/cpp/application_runner.h b/mojo/shell/public/cpp/application_runner.h index 10eb0a7..ddebcd7 100644 --- a/mojo/shell/public/cpp/application_runner.h +++ b/mojo/shell/public/cpp/application_runner.h @@ -11,7 +11,7 @@ namespace mojo { -class ApplicationDelegate; +class ShellClient; // A utility for running a chromium based mojo Application. The typical use // case is to use when writing your MojoMain: @@ -27,7 +27,7 @@ class ApplicationDelegate; class ApplicationRunner { public: // Takes ownership of |delegate|. - explicit ApplicationRunner(ApplicationDelegate* delegate); + explicit ApplicationRunner(ShellClient* client); ~ApplicationRunner(); static void InitBaseCommandLine(); @@ -47,7 +47,7 @@ class ApplicationRunner { MojoResult Run(MojoHandle shell_handle); private: - scoped_ptr<ApplicationDelegate> delegate_; + scoped_ptr<ShellClient> client_; // MessageLoop type. TYPE_CUSTOM is default (MessagePumpMojo will be used as // the underlying message pump). diff --git a/mojo/shell/public/cpp/application_test_base.h b/mojo/shell/public/cpp/application_test_base.h index 1dc3516..eec60d8 100644 --- a/mojo/shell/public/cpp/application_test_base.h +++ b/mojo/shell/public/cpp/application_test_base.h @@ -9,8 +9,8 @@ #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_delegate.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 "testing/gtest/include/gtest/gtest.h" @@ -29,15 +29,15 @@ MojoResult RunAllTests(MojoHandle application_request_handle); // ApplicationTestBase. class TestHelper { public: - explicit TestHelper(ApplicationDelegate* delegate); + explicit TestHelper(ShellClient* client); ~TestHelper(); Shell* shell() { return application_impl_.get(); } std::string shell_url() { return url_; } private: - // The application delegate used if GetApplicationDelegate is not overridden. - ApplicationDelegate default_application_delegate_; + // The application delegate used if GetShellClient is not overridden. + ShellClient default_shell_client_; // The application implementation instance, reconstructed for each test. scoped_ptr<ApplicationImpl> application_impl_; @@ -61,8 +61,8 @@ class ApplicationTestBase : public testing::Test { return test_helper_ ? test_helper_->shell_url() : std::string(); } - // Get the ApplicationDelegate for the application to be tested. - virtual ApplicationDelegate* GetApplicationDelegate(); + // Get the ShellClient for the application to be tested. + virtual ShellClient* GetShellClient(); // testing::Test: void SetUp() override; diff --git a/mojo/shell/public/cpp/application_connection.h b/mojo/shell/public/cpp/connection.h index 28a3a85..4be8669 100644 --- a/mojo/shell/public/cpp/application_connection.h +++ b/mojo/shell/public/cpp/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_CONNECTION_H_ -#define MOJO_SHELL_PUBLIC_CPP_APPLICATION_CONNECTION_H_ +#ifndef MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_ +#define MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_ #include <stdint.h> @@ -19,7 +19,7 @@ namespace mojo { class ServiceConnector; // Represents a connection to another application. An instance of this class is -// passed to ApplicationDelegate's AcceptConnection() method each +// passed to ShellClient's AcceptConnection() method each // time a connection is made to this app. // // To use, define a class that implements your specific service API (e.g., @@ -35,32 +35,29 @@ class ServiceConnector; // connection->AddService<Foo>(&my_foo_and_bar_factory_); // connection->AddService<Bar>(&my_foo_and_bar_factory_); // -// The InterfaceFactory must outlive the ApplicationConnection. +// The InterfaceFactory must outlive the Connection. // // Additionally you specify a ServiceConnector. If a ServiceConnector has // been set and an InterfaceFactory has not been registered for the interface // request, than the interface request is sent to the ServiceConnector. // -// Just as with InterfaceFactory, ServiceConnector must outlive -// ApplicationConnection. +// Just as with InterfaceFactory, ServiceConnector must outlive Connection. // -// An ApplicationConnection's lifetime is managed by an ApplicationImpl. To -// close a connection, call CloseConnection which will destroy this object. -class ApplicationConnection { +// An Connection's lifetime is managed by an ApplicationImpl. To close a +// connection, call CloseConnection which will destroy this object. +class Connection { public: - virtual ~ApplicationConnection() {} + virtual ~Connection() {} class TestApi { public: - explicit TestApi(ApplicationConnection* connection) - : connection_(connection) { - } - base::WeakPtr<ApplicationConnection> GetWeakPtr() { + explicit TestApi(Connection* connection) : connection_(connection) {} + base::WeakPtr<Connection> GetWeakPtr() { return connection_->GetWeakPtr(); } private: - ApplicationConnection* connection_; + Connection* connection_; }; // See class description for details. @@ -92,13 +89,13 @@ class ApplicationConnection { // Returns the URL that was used by the source application to establish a // connection to the destination application. // - // When ApplicationConnection is representing an incoming connection this can - // be different than the URL the application was initially loaded from, if the + // When Connection is representing an incoming connection this can be + // different than the URL the application was initially loaded from, if the // application handles multiple URLs. Note that this is the URL after all // URL rewriting and HTTP redirects have been performed. // - // When ApplicationConnection is representing and outgoing connection, this - // will be the same as the value returned by GetRemoveApplicationURL(). + // When Connection is representing and outgoing connection, this will be the + // same as the value returned by GetRemoveApplicationURL(). virtual const std::string& GetConnectionURL() = 0; // Returns the URL identifying the remote application on this connection. @@ -118,13 +115,12 @@ class ApplicationConnection { virtual void SetRemoteServiceProviderConnectionErrorHandler( const Closure& handler) = 0; - // Returns the id of the remote application. For ApplicationConnections - // created via ApplicationImpl::ConnectToApplication(), this will not be - // determined until ConnectToApplication()'s callback is run, and this - // function will return false. Use AddRemoteIDCallback() to schedule a - // callback to be run when the remote application id is available. A value of - // Shell::kInvalidApplicationID indicates no remote application connection - // has been established. + // Returns the id of the remote application. For Connections created via + // ApplicationImpl::ConnectToApplication(), this will not be determined until + // ConnectToApplication()'s callback is run, and this function will return + // false. Use AddRemoteIDCallback() to schedule a callback to be run when the + // remote application id is available. A value of Shell::kInvalidApplicationID + // indicates no remote application connection has been established. virtual bool GetRemoteApplicationID(uint32_t* remote_id) const = 0; // Returns the id of the deepest content handler used in connecting to @@ -144,9 +140,9 @@ class ApplicationConnection { virtual bool SetServiceConnectorForName(ServiceConnector* service_connector, const std::string& name) = 0; - virtual base::WeakPtr<ApplicationConnection> GetWeakPtr() = 0; + virtual base::WeakPtr<Connection> GetWeakPtr() = 0; }; } // namespace mojo -#endif // MOJO_SHELL_PUBLIC_CPP_APPLICATION_CONNECTION_H_ +#endif // MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_ diff --git a/mojo/shell/public/cpp/content_handler_factory.h b/mojo/shell/public/cpp/content_handler_factory.h index a8aa8c3..a174cdd 100644 --- a/mojo/shell/public/cpp/content_handler_factory.h +++ b/mojo/shell/public/cpp/content_handler_factory.h @@ -54,7 +54,7 @@ class ContentHandlerFactory private: // From InterfaceFactory: - void Create(ApplicationConnection* connection, + void Create(Connection* connection, InterfaceRequest<shell::mojom::ContentHandler> request) override; Delegate* delegate_; diff --git a/mojo/shell/public/cpp/interface_factory.h b/mojo/shell/public/cpp/interface_factory.h index 7f8f26e..7edf000 100644 --- a/mojo/shell/public/cpp/interface_factory.h +++ b/mojo/shell/public/cpp/interface_factory.h @@ -9,7 +9,7 @@ namespace mojo { -class ApplicationConnection; +class Connection; template <typename Interface> class InterfaceRequest; @@ -21,7 +21,7 @@ template <typename Interface> class InterfaceFactory { public: virtual ~InterfaceFactory() {} - virtual void Create(ApplicationConnection* connection, + virtual void Create(Connection* connection, InterfaceRequest<Interface> request) = 0; }; diff --git a/mojo/shell/public/cpp/interface_factory_impl.h b/mojo/shell/public/cpp/interface_factory_impl.h index 7de2449..f849922 100644 --- a/mojo/shell/public/cpp/interface_factory_impl.h +++ b/mojo/shell/public/cpp/interface_factory_impl.h @@ -17,7 +17,7 @@ class InterfaceFactoryImpl : public InterfaceFactory<Interface> { public: virtual ~InterfaceFactoryImpl() {} - virtual void Create(ApplicationConnection* connection, + virtual void Create(Connection* connection, InterfaceRequest<Interface> request) override { BindToRequest(new Impl(), &request); } @@ -35,7 +35,7 @@ class InterfaceFactoryImplWithContext : public InterfaceFactory<Interface> { : context_(context) {} virtual ~InterfaceFactoryImplWithContext() {} - virtual void Create(ApplicationConnection* connection, + virtual void Create(Connection* connection, InterfaceRequest<Interface> request) override { BindToRequest(new Impl(context_), &request); } diff --git a/mojo/shell/public/cpp/lib/application_delegate.cc b/mojo/shell/public/cpp/lib/application_delegate.cc deleted file mode 100644 index 7c84264..0000000 --- a/mojo/shell/public/cpp/lib/application_delegate.cc +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "mojo/shell/public/cpp/application_delegate.h" - -namespace mojo { - -ApplicationDelegate::ApplicationDelegate() { -} -ApplicationDelegate::~ApplicationDelegate() { -} - -void ApplicationDelegate::Initialize(Shell* app, const std::string& url, - uint32_t id) { -} - -bool ApplicationDelegate::AcceptConnection(ApplicationConnection* connection) { - return true; -} - -bool ApplicationDelegate::ShellConnectionLost() { - return true; -} - -void ApplicationDelegate::Quit() { -} - -} // namespace mojo diff --git a/mojo/shell/public/cpp/lib/application_impl.cc b/mojo/shell/public/cpp/lib/application_impl.cc index ca149a3..d51e5aa 100644 --- a/mojo/shell/public/cpp/lib/application_impl.cc +++ b/mojo/shell/public/cpp/lib/application_impl.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_delegate.h" #include "mojo/shell/public/cpp/application_impl.h" #include "mojo/shell/public/cpp/lib/service_registry.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace mojo { @@ -36,17 +36,17 @@ ApplicationImpl::ConnectParams::ConnectParams(URLRequestPtr request) ApplicationImpl::ConnectParams::~ConnectParams() {} ApplicationImpl::ApplicationImpl( - ApplicationDelegate* delegate, + ShellClient* client, InterfaceRequest<shell::mojom::Application> request) - : ApplicationImpl(delegate, + : ApplicationImpl(client, std::move(request), base::Bind(&DefaultTerminationClosure)) {} ApplicationImpl::ApplicationImpl( - ApplicationDelegate* delegate, + ShellClient* client, InterfaceRequest<shell::mojom::Application> request, const Closure& termination_closure) - : delegate_(delegate), + : client_(client), binding_(this, std::move(request)), termination_closure_(termination_closure), app_lifetime_helper_(this), @@ -62,15 +62,15 @@ void ApplicationImpl::WaitForInitialize() { binding_.WaitForIncomingMethodCall(); } -scoped_ptr<ApplicationConnection> ApplicationImpl::ConnectToApplication( +scoped_ptr<Connection> ApplicationImpl::ConnectToApplication( const std::string& url) { ConnectParams params(url); params.set_filter(CreatePermissiveCapabilityFilter()); return ConnectToApplication(¶ms); } -scoped_ptr<ApplicationConnection> - ApplicationImpl::ConnectToApplication(ConnectParams* params) { +scoped_ptr<Connection> ApplicationImpl::ConnectToApplication( + ConnectParams* params) { if (!shell_) return nullptr; DCHECK(params); @@ -118,7 +118,7 @@ void ApplicationImpl::Initialize(shell::mojom::ShellPtr shell, uint32_t id) { shell_ = std::move(shell); shell_.set_connection_error_handler([this]() { OnConnectionError(); }); - delegate_->Initialize(this, url, id); + client_->Initialize(this, url, id); } void ApplicationImpl::AcceptConnection( @@ -128,10 +128,10 @@ void ApplicationImpl::AcceptConnection( ServiceProviderPtr exposed_services, Array<String> allowed_interfaces, const String& url) { - scoped_ptr<ApplicationConnection> registry(new internal::ServiceRegistry( + scoped_ptr<Connection> registry(new internal::ServiceRegistry( url, requestor_url, requestor_id, std::move(exposed_services), std::move(services), allowed_interfaces.To<std::set<std::string>>())); - if (!delegate_->AcceptConnection(registry.get())) + if (!client_->AcceptConnection(registry.get())) return; // If we were quitting because we thought there were no more services for this @@ -154,11 +154,11 @@ void ApplicationImpl::OnQuitRequested(const Callback<void(bool)>& callback) { void ApplicationImpl::OnConnectionError() { base::WeakPtr<ApplicationImpl> ptr(weak_factory_.GetWeakPtr()); - // We give the delegate notice first, since it might want to do something on + // We give the client notice first, since it might want to do something on // shell connection errors other than immediate termination of the run // loop. The application might want to continue servicing connections other // than the one to the shell. - bool quit_now = delegate_->ShellConnectionLost(); + bool quit_now = client_->ShellConnectionLost(); if (quit_now) QuitNow(); if (!ptr) @@ -167,7 +167,7 @@ void ApplicationImpl::OnConnectionError() { } void ApplicationImpl::QuitNow() { - delegate_->Quit(); + client_->Quit(); termination_closure_.Run(); } diff --git a/mojo/shell/public/cpp/lib/application_runner.cc b/mojo/shell/public/cpp/lib/application_runner.cc index e95133e..245dcd5 100644 --- a/mojo/shell/public/cpp/lib/application_runner.cc +++ b/mojo/shell/public/cpp/lib/application_runner.cc @@ -10,16 +10,16 @@ #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_delegate.h" #include "mojo/shell/public/cpp/application_impl.h" +#include "mojo/shell/public/cpp/shell_client.h" namespace mojo { int g_application_runner_argc; const char* const* g_application_runner_argv; -ApplicationRunner::ApplicationRunner(ApplicationDelegate* delegate) - : delegate_(scoped_ptr<ApplicationDelegate>(delegate)), +ApplicationRunner::ApplicationRunner(ShellClient* client) + : client_(scoped_ptr<ShellClient>(client)), message_loop_type_(base::MessageLoop::TYPE_CUSTOM), has_run_(false) {} @@ -54,19 +54,19 @@ MojoResult ApplicationRunner::Run(MojoHandle application_request_handle, else loop.reset(new base::MessageLoop(message_loop_type_)); - ApplicationImpl impl(delegate_.get(), + ApplicationImpl impl(client_.get(), MakeRequest<shell::mojom::Application>( MakeScopedHandle(MessagePipeHandle( application_request_handle)))); loop->Run(); - // It's very common for the delegate to cache the app and terminate on - // errors. If we don't delete the delegate before the app we run the risk - // of the delegate having a stale reference to the app and trying to use it. + // 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 + // client having a stale reference to the app and trying to use it. // Note that we destruct the message loop first because that might trigger // connection error handlers and they might access objects created by the - // delegate. + // client. loop.reset(); - delegate_.reset(); + client_.reset(); } return MOJO_RESULT_OK; } diff --git a/mojo/shell/public/cpp/lib/application_test_base.cc b/mojo/shell/public/cpp/lib/application_test_base.cc index 3d6ad90..2bf6975 100644 --- a/mojo/shell/public/cpp/lib/application_test_base.cc +++ b/mojo/shell/public/cpp/lib/application_test_base.cc @@ -113,9 +113,9 @@ MojoResult RunAllTests(MojoHandle application_request_handle) { return (result == 0) ? MOJO_RESULT_OK : MOJO_RESULT_UNKNOWN; } -TestHelper::TestHelper(ApplicationDelegate* delegate) +TestHelper::TestHelper(ShellClient* client) : application_impl_(new ApplicationImpl( - delegate == nullptr ? &default_application_delegate_ : delegate, + client == nullptr ? &default_shell_client_ : client, std::move(g_application_request))), url_(g_url) { // Fake application initialization. @@ -129,7 +129,7 @@ TestHelper::~TestHelper() { // ApplicationImpl::TestApi test_api(application_impl_); // test_api.UnbindConnections(&g_application_request, &g_shell); // } - // We may have supplied a member as the delegate. Delete |application_impl_| + // We may have supplied a member as the client. Delete |application_impl_| // while still valid. application_impl_.reset(); } @@ -139,7 +139,7 @@ ApplicationTestBase::ApplicationTestBase() : test_helper_(nullptr) {} ApplicationTestBase::~ApplicationTestBase() { } -ApplicationDelegate* ApplicationTestBase::GetApplicationDelegate() { +ShellClient* ApplicationTestBase::GetShellClient() { return nullptr; } @@ -153,7 +153,7 @@ void ApplicationTestBase::SetUp() { MOJO_CHECK(g_shell); // New applications are constructed for each test to avoid persisting state. - test_helper_.reset(new TestHelper(GetApplicationDelegate())); + test_helper_.reset(new TestHelper(GetShellClient())); } void ApplicationTestBase::TearDown() { diff --git a/mojo/shell/public/cpp/lib/content_handler_factory.cc b/mojo/shell/public/cpp/lib/content_handler_factory.cc index 17714f5..156faf0 100644 --- a/mojo/shell/public/cpp/lib/content_handler_factory.cc +++ b/mojo/shell/public/cpp/lib/content_handler_factory.cc @@ -15,7 +15,7 @@ #include "base/threading/platform_thread.h" #include "mojo/message_pump/message_pump_mojo.h" #include "mojo/public/cpp/bindings/strong_binding.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/content_handler_factory.h" #include "mojo/shell/public/cpp/interface_factory_impl.h" @@ -134,7 +134,7 @@ void ContentHandlerFactory::ManagedDelegate::RunApplication( } void ContentHandlerFactory::Create( - ApplicationConnection* connection, + Connection* connection, InterfaceRequest<shell::mojom::ContentHandler> request) { new ContentHandlerImpl(delegate_, std::move(request)); } diff --git a/mojo/shell/public/cpp/lib/interface_factory_connector.h b/mojo/shell/public/cpp/lib/interface_factory_connector.h index 5ef7eaa..42c4c03 100644 --- a/mojo/shell/public/cpp/lib/interface_factory_connector.h +++ b/mojo/shell/public/cpp/lib/interface_factory_connector.h @@ -21,10 +21,10 @@ class InterfaceFactoryConnector : public ServiceConnector { : factory_(factory) {} ~InterfaceFactoryConnector() override {} - void ConnectToService(ApplicationConnection* application_connection, + void ConnectToService(Connection* connection, const std::string& interface_name, ScopedMessagePipeHandle client_handle) override { - factory_->Create(application_connection, + factory_->Create(connection, MakeRequest<Interface>(std::move(client_handle))); } diff --git a/mojo/shell/public/cpp/lib/service_connector_registry.cc b/mojo/shell/public/cpp/lib/service_connector_registry.cc index edc91e0..fc74ef0 100644 --- a/mojo/shell/public/cpp/lib/service_connector_registry.cc +++ b/mojo/shell/public/cpp/lib/service_connector_registry.cc @@ -42,17 +42,17 @@ void ServiceConnectorRegistry::RemoveServiceConnectorForName( } void ServiceConnectorRegistry::ConnectToService( - ApplicationConnection* application_connection, + Connection* connection, const std::string& interface_name, ScopedMessagePipeHandle client_handle) { auto iter = name_to_service_connector_.find(interface_name); if (iter != name_to_service_connector_.end()) { - iter->second->ConnectToService(application_connection, interface_name, + iter->second->ConnectToService(connection, interface_name, std::move(client_handle)); return; } if (service_connector_) { - service_connector_->ConnectToService(application_connection, interface_name, + service_connector_->ConnectToService(connection, interface_name, std::move(client_handle)); } } diff --git a/mojo/shell/public/cpp/lib/service_connector_registry.h b/mojo/shell/public/cpp/lib/service_connector_registry.h index 9475436..4bf400f 100644 --- a/mojo/shell/public/cpp/lib/service_connector_registry.h +++ b/mojo/shell/public/cpp/lib/service_connector_registry.h @@ -12,7 +12,7 @@ namespace mojo { -class ApplicationConnection; +class Connection; class ServiceConnector; namespace internal { @@ -42,7 +42,7 @@ class ServiceConnectorRegistry { const std::string& interface_name); void RemoveServiceConnectorForName(const std::string& interface_name); - void ConnectToService(ApplicationConnection* application_connection, + void ConnectToService(Connection* connection, const std::string& interface_name, ScopedMessagePipeHandle client_handle); diff --git a/mojo/shell/public/cpp/lib/service_provider_impl.cc b/mojo/shell/public/cpp/lib/service_provider_impl.cc index 4a411a2..dc31a8b 100644 --- a/mojo/shell/public/cpp/lib/service_provider_impl.cc +++ b/mojo/shell/public/cpp/lib/service_provider_impl.cc @@ -28,7 +28,7 @@ void ServiceProviderImpl::ConnectToService( const String& service_name, ScopedMessagePipeHandle client_handle) { // TODO(beng): perhaps take app connection thru ctor so that we can pass - // ApplicationConnection through? + // Connection through? service_connector_registry_.ConnectToService(nullptr, service_name, std::move(client_handle)); } diff --git a/mojo/shell/public/cpp/lib/service_registry.cc b/mojo/shell/public/cpp/lib/service_registry.cc index 1425276..1df9976 100644 --- a/mojo/shell/public/cpp/lib/service_registry.cc +++ b/mojo/shell/public/cpp/lib/service_registry.cc @@ -10,7 +10,7 @@ #include "base/bind.h" #include "base/logging.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/service_connector.h" namespace mojo { @@ -106,7 +106,7 @@ void ServiceRegistry::AddRemoteIDCallback(const Closure& callback) { remote_id_callbacks_.push_back(callback); } -base::WeakPtr<ApplicationConnection> ServiceRegistry::GetWeakPtr() { +base::WeakPtr<Connection> ServiceRegistry::GetWeakPtr() { return weak_factory_.GetWeakPtr(); } diff --git a/mojo/shell/public/cpp/lib/service_registry.h b/mojo/shell/public/cpp/lib/service_registry.h index 74c2e34..683e220 100644 --- a/mojo/shell/public/cpp/lib/service_registry.h +++ b/mojo/shell/public/cpp/lib/service_registry.h @@ -11,7 +11,7 @@ #include <string> #include "mojo/public/cpp/bindings/binding.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/lib/service_connector_registry.h" #include "mojo/shell/public/interfaces/service_provider.mojom.h" #include "mojo/shell/public/interfaces/shell.mojom.h" @@ -22,7 +22,7 @@ namespace internal { // A ServiceRegistry represents each half of a connection between two // applications, allowing customization of which services are published to the // other. -class ServiceRegistry : public ServiceProvider, public ApplicationConnection { +class ServiceRegistry : public ServiceProvider, public Connection { public: ServiceRegistry(); // |allowed_interfaces| are the set of interfaces that the shell has allowed @@ -39,7 +39,7 @@ class ServiceRegistry : public ServiceProvider, public ApplicationConnection { shell::mojom::Shell::ConnectToApplicationCallback GetConnectToApplicationCallback(); - // ApplicationConnection overrides. + // Connection overrides. void SetServiceConnector(ServiceConnector* service_connector) override; bool SetServiceConnectorForName(ServiceConnector* service_connector, const std::string& interface_name) override; @@ -52,7 +52,7 @@ class ServiceRegistry : public ServiceProvider, public ApplicationConnection { bool GetRemoteApplicationID(uint32_t* remote_id) const override; bool GetRemoteContentHandlerID(uint32_t* content_handler_id) const override; void AddRemoteIDCallback(const Closure& callback) override; - base::WeakPtr<ApplicationConnection> GetWeakPtr() override; + base::WeakPtr<Connection> GetWeakPtr() override; void RemoveServiceConnectorForName(const std::string& interface_name); diff --git a/mojo/shell/public/cpp/lib/shell_client.cc b/mojo/shell/public/cpp/lib/shell_client.cc new file mode 100644 index 0000000..b3e83b5 --- /dev/null +++ b/mojo/shell/public/cpp/lib/shell_client.cc @@ -0,0 +1,26 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/shell/public/cpp/shell_client.h" + +namespace mojo { + +ShellClient::ShellClient() {} +ShellClient::~ShellClient() {} + +void ShellClient::Initialize(Shell* app, const std::string& url, + uint32_t id) { +} + +bool ShellClient::AcceptConnection(Connection* connection) { + return false; +} + +bool ShellClient::ShellConnectionLost() { + return true; +} + +void ShellClient::Quit() {} + +} // namespace mojo diff --git a/mojo/shell/public/cpp/service_connector.h b/mojo/shell/public/cpp/service_connector.h index 8856e3f..5ba0192 100644 --- a/mojo/shell/public/cpp/service_connector.h +++ b/mojo/shell/public/cpp/service_connector.h @@ -11,7 +11,7 @@ namespace mojo { -class ApplicationConnection; +class Connection; class ServiceConnector { public: @@ -20,7 +20,7 @@ class ServiceConnector { // Asks the ServiceConnector to connect to the specified service. If the // ServiceConnector connects to the service it should take ownership of // the handle in |handle|. - virtual void ConnectToService(ApplicationConnection* application_connection, + virtual void ConnectToService(Connection* connection, const std::string& interface_name, ScopedMessagePipeHandle handle) = 0; }; diff --git a/mojo/shell/public/cpp/shell.h b/mojo/shell/public/cpp/shell.h index 2a3acb3..1610693 100644 --- a/mojo/shell/public/cpp/shell.h +++ b/mojo/shell/public/cpp/shell.h @@ -6,7 +6,7 @@ #define MOJO_SHELL_PUBLIC_CPP_SHELL_H_ #include "mojo/shell/public/cpp/app_lifetime_helper.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/interfaces/application.mojom.h" #include "mojo/shell/public/interfaces/shell.mojom.h" @@ -42,16 +42,16 @@ class Shell { // Requests a new connection to an application. Returns a pointer to the // connection if the connection is permitted by this application's delegate, // or nullptr otherwise. Caller takes ownership. - virtual scoped_ptr<ApplicationConnection> ConnectToApplication( + virtual scoped_ptr<Connection> ConnectToApplication( const std::string& url) = 0; - virtual scoped_ptr<ApplicationConnection> ConnectToApplication( + virtual scoped_ptr<Connection> ConnectToApplication( ConnectParams* params) = 0; // Connect to application identified by |request->url| and connect to the // service implementation of the interface identified by |Interface|. template <typename Interface> void ConnectToService(ConnectParams* params, InterfacePtr<Interface>* ptr) { - scoped_ptr<ApplicationConnection> connection = ConnectToApplication(params); + scoped_ptr<Connection> connection = ConnectToApplication(params); if (!connection.get()) return; connection->ConnectToService(ptr); diff --git a/mojo/shell/public/cpp/application_delegate.h b/mojo/shell/public/cpp/shell_client.h index b0a537f..e7c56d9 100644 --- a/mojo/shell/public/cpp/application_delegate.h +++ b/mojo/shell/public/cpp/shell_client.h @@ -2,40 +2,43 @@ // 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_DELEGATE_H_ -#define MOJO_SHELL_PUBLIC_CPP_APPLICATION_DELEGATE_H_ +#ifndef MOJO_SHELL_PUBLIC_CPP_SHELL_CLIENT_H_ +#define MOJO_SHELL_PUBLIC_CPP_SHELL_CLIENT_H_ #include <stdint.h> #include <string> #include "mojo/public/cpp/system/macros.h" +#include "mojo/shell/public/cpp/connection.h" namespace mojo { -class ApplicationConnection; -class ApplicationImpl; class Shell; // An abstract class that the application may subclass to control various // behaviors of ApplicationImpl. -class ApplicationDelegate { +class ShellClient { public: - ApplicationDelegate(); - virtual ~ApplicationDelegate(); + ShellClient(); + virtual ~ShellClient(); + // Called once a bidirectional connection with the shell has been established. + // |url| is the URL used to start the application. |id| is a unique identifier + // the shell uses to identify this specific instance of the application. // Called exactly once before any other method. - virtual void Initialize(Shell* app, const std::string& url, uint32_t id); + virtual void Initialize(Shell* shell, const std::string& url, uint32_t id); // Override this method to configure what services a connection supports when // being connected to from an app. - // Return false to reject the connection entirely. - virtual bool AcceptConnection(ApplicationConnection* connection); + // Return false to reject the connection entirely. The default implementation + // returns false. + virtual bool AcceptConnection(Connection* connection); // Called when the shell connection has a connection error. // // 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. + // ApplicationImpl::QuitNow() when done. Default implementation returns true. virtual bool ShellConnectionLost(); // Called before ApplicationImpl::Terminate(). After returning from this call @@ -43,9 +46,9 @@ class ApplicationDelegate { virtual void Quit(); private: - MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationDelegate); + MOJO_DISALLOW_COPY_AND_ASSIGN(ShellClient); }; } // namespace mojo -#endif // MOJO_SHELL_PUBLIC_CPP_APPLICATION_DELEGATE_H_ +#endif // MOJO_SHELL_PUBLIC_CPP_SHELL_CLIENT_H_ diff --git a/mojo/shell/public/cpp/tests/service_registry_unittest.cc b/mojo/shell/public/cpp/tests/service_registry_unittest.cc index 349e9aa..dc29d37 100644 --- a/mojo/shell/public/cpp/tests/service_registry_unittest.cc +++ b/mojo/shell/public/cpp/tests/service_registry_unittest.cc @@ -16,7 +16,7 @@ class TestConnector : public ServiceConnector { public: explicit TestConnector(int* delete_count) : delete_count_(delete_count) {} ~TestConnector() override { (*delete_count_)++; } - void ConnectToService(ApplicationConnection* application_connection, + void ConnectToService(Connection* connection, const std::string& interface_name, ScopedMessagePipeHandle client_handle) override {} diff --git a/mojo/shell/runner/child/native_apptest_target.cc b/mojo/shell/runner/child/native_apptest_target.cc index ecdbaf4..ff8a8fb 100644 --- a/mojo/shell/runner/child/native_apptest_target.cc +++ b/mojo/shell/runner/child/native_apptest_target.cc @@ -8,10 +8,10 @@ #include "base/command_line.h" #include "base/macros.h" #include "mojo/common/weak_binding_set.h" -#include "mojo/shell/public/cpp/application_connection.h" -#include "mojo/shell/public/cpp/application_delegate.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/interface_factory.h" #include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/shell_client.h" #include "mojo/shell/runner/child/test_native_main.h" #include "mojo/shell/runner/child/test_native_service.mojom.h" #include "mojo/shell/runner/init.h" @@ -19,7 +19,7 @@ namespace { class TargetApplicationDelegate - : public mojo::ApplicationDelegate, + : public mojo::ShellClient, public mojo::shell::test::TestNativeService, public mojo::InterfaceFactory<mojo::shell::test::TestNativeService> { public: @@ -27,11 +27,10 @@ class TargetApplicationDelegate ~TargetApplicationDelegate() override {} private: - // mojo::ApplicationDelegate: + // mojo::ShellClient: void Initialize(mojo::Shell* shell, const std::string& url, uint32_t id) override {} - bool AcceptConnection( - mojo::ApplicationConnection* connection) override { + bool AcceptConnection(mojo::Connection* connection) override { connection->AddService<mojo::shell::test::TestNativeService>(this); return true; } @@ -42,7 +41,7 @@ class TargetApplicationDelegate } // mojo::InterfaceFactory<mojo::shell::test::TestNativeService>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<mojo::shell::test::TestNativeService> request) override { bindings_.AddBinding(this, std::move(request)); diff --git a/mojo/shell/runner/child/test_native_main.cc b/mojo/shell/runner/child/test_native_main.cc index 3e63eec5..537b32b 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_delegate.h" #include "mojo/shell/public/cpp/application_impl.h" +#include "mojo/shell/public/cpp/shell_client.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::ApplicationDelegate* application_delegate) { +int TestNativeMain(mojo::ShellClient* application_delegate) { mojo::shell::WaitForDebuggerIfNecessary(); #if !defined(OFFICIAL_BUILD) diff --git a/mojo/shell/runner/child/test_native_main.h b/mojo/shell/runner/child/test_native_main.h index 2a08756..600e814 100644 --- a/mojo/shell/runner/child/test_native_main.h +++ b/mojo/shell/runner/child/test_native_main.h @@ -6,10 +6,10 @@ #define MOJO_SHELL_RUNNER_CHILD_TEST_NATIVE_MAIN_H_ namespace mojo { -class ApplicationDelegate; +class ShellClient; namespace shell { -int TestNativeMain(mojo::ApplicationDelegate* application_delegate); +int TestNativeMain(mojo::ShellClient* application_delegate); } // namespace shell } // namespace mojo diff --git a/mojo/shell/shell_application_delegate.cc b/mojo/shell/shell_application_delegate.cc index e472617..dcac9de 100644 --- a/mojo/shell/shell_application_delegate.cc +++ b/mojo/shell/shell_application_delegate.cc @@ -10,7 +10,7 @@ #include "base/process/process.h" #include "mojo/shell/application_manager.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" namespace mojo { @@ -23,14 +23,13 @@ ShellApplicationDelegate::~ShellApplicationDelegate() {} void ShellApplicationDelegate::Initialize(Shell* shell, const std::string& url, uint32_t id) {} -bool ShellApplicationDelegate::AcceptConnection( - ApplicationConnection* connection) { +bool ShellApplicationDelegate::AcceptConnection(Connection* connection) { connection->AddService<mojom::ApplicationManager>(this); return true; } void ShellApplicationDelegate::Create( - ApplicationConnection* connection, + Connection* connection, InterfaceRequest<mojom::ApplicationManager> request) { bindings_.AddBinding(this, std::move(request)); } diff --git a/mojo/shell/shell_application_delegate.h b/mojo/shell/shell_application_delegate.h index 84e384b..fcc3260 100644 --- a/mojo/shell/shell_application_delegate.h +++ b/mojo/shell/shell_application_delegate.h @@ -5,13 +5,12 @@ #ifndef MOJO_SHELL_SHELL_APPLICATION_DELEGATE_H_ #define MOJO_SHELL_SHELL_APPLICATION_DELEGATE_H_ -#include "mojo/shell/public/cpp/application_delegate.h" - #include <stdint.h> #include "base/macros.h" #include "mojo/common/weak_binding_set.h" #include "mojo/shell/public/cpp/interface_factory.h" +#include "mojo/shell/public/cpp/shell_client.h" #include "mojo/shell/public/interfaces/application_manager.mojom.h" namespace mojo { @@ -19,7 +18,7 @@ namespace shell { class ApplicationManager; class ShellApplicationDelegate - : public ApplicationDelegate, + : public ShellClient, public InterfaceFactory<mojom::ApplicationManager>, public mojom::ApplicationManager { public: @@ -27,13 +26,13 @@ class ShellApplicationDelegate ~ShellApplicationDelegate() override; private: - // Overridden from ApplicationDelegate: + // Overridden from ShellClient: void Initialize(Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection(ApplicationConnection* connection) override; + bool AcceptConnection(Connection* connection) override; // Overridden from InterfaceFactory<mojom::ApplicationManager>: void Create( - ApplicationConnection* connection, + Connection* connection, InterfaceRequest<mojom::ApplicationManager> request) override; // Overridden from mojom::ApplicationManager: diff --git a/mojo/shell/standalone/android/android_handler.cc b/mojo/shell/standalone/android/android_handler.cc index 175923b..9878824 100644 --- a/mojo/shell/standalone/android/android_handler.cc +++ b/mojo/shell/standalone/android/android_handler.cc @@ -170,7 +170,7 @@ void AndroidHandler::Initialize(Shell* shell, const std::string& url, uint32_t id) {} -bool AndroidHandler::AcceptConnection(ApplicationConnection* connection) { +bool AndroidHandler::AcceptConnection(Connection* connection) { connection->AddService(&content_handler_factory_); return true; } diff --git a/mojo/shell/standalone/android/android_handler.h b/mojo/shell/standalone/android/android_handler.h index e58d3bf..ed8ad3e 100644 --- a/mojo/shell/standalone/android/android_handler.h +++ b/mojo/shell/standalone/android/android_handler.h @@ -7,9 +7,9 @@ #include <jni.h> -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/content_handler_factory.h" #include "mojo/shell/public/cpp/interface_factory_impl.h" +#include "mojo/shell/public/cpp/shell_client.h" #include "mojo/shell/public/interfaces/content_handler.mojom.h" namespace base { @@ -19,16 +19,16 @@ class FilePath; namespace mojo { namespace shell { -class AndroidHandler : public ApplicationDelegate, +class AndroidHandler : public ShellClient, public ContentHandlerFactory::Delegate { public: AndroidHandler(); ~AndroidHandler(); private: - // ApplicationDelegate: + // mojo::ShellClient: void Initialize(Shell* shell, const std::string& url, uint32_t id) override; - bool AcceptConnection(ApplicationConnection* connection) override; + bool AcceptConnection(Connection* connection) override; // ContentHandlerFactory::Delegate: void RunApplication(InterfaceRequest<mojom::Application> application_request, diff --git a/mojo/shell/standalone/test/pingable_app.cc b/mojo/shell/standalone/test/pingable_app.cc index 31613b8..9b43df1 100644 --- a/mojo/shell/standalone/test/pingable_app.cc +++ b/mojo/shell/standalone/test/pingable_app.cc @@ -6,10 +6,10 @@ #include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/public/cpp/bindings/strong_binding.h" -#include "mojo/shell/public/cpp/application_delegate.h" #include "mojo/shell/public/cpp/application_runner.h" #include "mojo/shell/public/cpp/interface_factory.h" #include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/shell_client.h" #include "mojo/shell/standalone/test/pingable.mojom.h" namespace mojo { @@ -36,25 +36,25 @@ class PingableImpl : public Pingable { std::string connection_url_; }; -class PingableApp : public mojo::ApplicationDelegate, +class PingableApp : public mojo::ShellClient, public mojo::InterfaceFactory<Pingable> { public: PingableApp() {} ~PingableApp() override {} private: - // ApplicationDelegate: + // mojo::ShellClient: void Initialize(Shell* shell, const std::string& url, uint32_t id) override { app_url_ = url; } - bool AcceptConnection(mojo::ApplicationConnection* connection) override { + bool AcceptConnection(mojo::Connection* connection) override { connection->AddService(this); return true; } // InterfaceFactory<Pingable>: - void Create(mojo::ApplicationConnection* connection, + void Create(mojo::Connection* connection, mojo::InterfaceRequest<Pingable> request) override { new PingableImpl(std::move(request), app_url_, connection->GetConnectionURL()); diff --git a/mojo/shell/static_application_loader.cc b/mojo/shell/static_application_loader.cc index c7e7f5e..7b51027 100644 --- a/mojo/shell/static_application_loader.cc +++ b/mojo/shell/static_application_loader.cc @@ -13,8 +13,8 @@ #include "base/thread_task_runner_handle.h" #include "base/threading/simple_thread.h" #include "mojo/public/cpp/bindings/interface_request.h" -#include "mojo/shell/public/cpp/application_delegate.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" namespace mojo { diff --git a/mojo/shell/static_application_loader.h b/mojo/shell/static_application_loader.h index 9cb5cae..38b4a87 100644 --- a/mojo/shell/static_application_loader.h +++ b/mojo/shell/static_application_loader.h @@ -17,20 +17,20 @@ class SimpleThread; } namespace mojo { -class ApplicationDelegate; +class ShellClient; } namespace mojo { namespace shell { // An ApplicationLoader which loads a single type of app from a given -// ApplicationDelegate factory. A Load() request is fulfilled by creating an +// mojo::ShellClient factory. A Load() request is fulfilled by creating an // instance of the app on a new thread. Only one instance of the app will run at // a time. Any Load requests received while the app is running will be dropped. class StaticApplicationLoader : public mojo::shell::ApplicationLoader { public: using ApplicationFactory = - base::Callback<scoped_ptr<mojo::ApplicationDelegate>()>; + base::Callback<scoped_ptr<mojo::ShellClient>()>; // Constructs a static loader for |factory|. explicit StaticApplicationLoader(const ApplicationFactory& factory); diff --git a/ui/views/mus/screen_mus.cc b/ui/views/mus/screen_mus.cc index 261f8f09e4..354af1c 100644 --- a/ui/views/mus/screen_mus.cc +++ b/ui/views/mus/screen_mus.cc @@ -6,7 +6,7 @@ // #include "components/mus/public/interfaces/window_manager_constants.mojom.h" #include "mojo/converters/geometry/geometry_type_converters.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" #include "ui/gfx/display_finder.h" #include "ui/gfx/display_observer.h" diff --git a/ui/views/mus/window_manager_connection.cc b/ui/views/mus/window_manager_connection.cc index 04e0db7..173572d 100644 --- a/ui/views/mus/window_manager_connection.cc +++ b/ui/views/mus/window_manager_connection.cc @@ -12,7 +12,7 @@ #include "components/mus/public/interfaces/window_tree.mojom.h" #include "mojo/converters/geometry/geometry_type_converters.h" #include "mojo/converters/network/network_type_converters.h" -#include "mojo/shell/public/cpp/application_connection.h" +#include "mojo/shell/public/cpp/connection.h" #include "mojo/shell/public/cpp/shell.h" #include "ui/views/mus/native_widget_mus.h" #include "ui/views/mus/screen_mus.h" |