summaryrefslogtreecommitdiffstats
path: root/mojo/shell
diff options
context:
space:
mode:
Diffstat (limited to 'mojo/shell')
-rw-r--r--mojo/shell/application_manager_apptest.cc15
-rw-r--r--mojo/shell/application_manager_apptest_driver.cc12
-rw-r--r--mojo/shell/application_manager_apptest_target.cc8
-rw-r--r--mojo/shell/application_manager_unittest.cc27
-rw-r--r--mojo/shell/application_package_apptest.cc22
-rw-r--r--mojo/shell/capability_filter_test.cc28
-rw-r--r--mojo/shell/capability_filter_test.h21
-rw-r--r--mojo/shell/fetcher/about_fetcher_unittest.cc15
-rw-r--r--mojo/shell/package_manager/capability_filter_content_handler_unittest.cc15
-rw-r--r--mojo/shell/package_manager/content_handler_unittest.cc15
-rw-r--r--mojo/shell/public/cpp/BUILD.gn6
-rw-r--r--mojo/shell/public/cpp/application_impl.h17
-rw-r--r--mojo/shell/public/cpp/application_runner.h6
-rw-r--r--mojo/shell/public/cpp/application_test_base.h12
-rw-r--r--mojo/shell/public/cpp/connection.h (renamed from mojo/shell/public/cpp/application_connection.h)52
-rw-r--r--mojo/shell/public/cpp/content_handler_factory.h2
-rw-r--r--mojo/shell/public/cpp/interface_factory.h4
-rw-r--r--mojo/shell/public/cpp/interface_factory_impl.h4
-rw-r--r--mojo/shell/public/cpp/lib/application_delegate.cc29
-rw-r--r--mojo/shell/public/cpp/lib/application_impl.cc28
-rw-r--r--mojo/shell/public/cpp/lib/application_runner.cc18
-rw-r--r--mojo/shell/public/cpp/lib/application_test_base.cc10
-rw-r--r--mojo/shell/public/cpp/lib/content_handler_factory.cc4
-rw-r--r--mojo/shell/public/cpp/lib/interface_factory_connector.h4
-rw-r--r--mojo/shell/public/cpp/lib/service_connector_registry.cc6
-rw-r--r--mojo/shell/public/cpp/lib/service_connector_registry.h4
-rw-r--r--mojo/shell/public/cpp/lib/service_provider_impl.cc2
-rw-r--r--mojo/shell/public/cpp/lib/service_registry.cc4
-rw-r--r--mojo/shell/public/cpp/lib/service_registry.h8
-rw-r--r--mojo/shell/public/cpp/lib/shell_client.cc26
-rw-r--r--mojo/shell/public/cpp/service_connector.h4
-rw-r--r--mojo/shell/public/cpp/shell.h8
-rw-r--r--mojo/shell/public/cpp/shell_client.h (renamed from mojo/shell/public/cpp/application_delegate.h)29
-rw-r--r--mojo/shell/public/cpp/tests/service_registry_unittest.cc2
-rw-r--r--mojo/shell/runner/child/native_apptest_target.cc13
-rw-r--r--mojo/shell/runner/child/test_native_main.cc4
-rw-r--r--mojo/shell/runner/child/test_native_main.h4
-rw-r--r--mojo/shell/shell_application_delegate.cc7
-rw-r--r--mojo/shell/shell_application_delegate.h11
-rw-r--r--mojo/shell/standalone/android/android_handler.cc2
-rw-r--r--mojo/shell/standalone/android/android_handler.h8
-rw-r--r--mojo/shell/standalone/test/pingable_app.cc10
-rw-r--r--mojo/shell/static_application_loader.cc2
-rw-r--r--mojo/shell/static_application_loader.h6
44 files changed, 259 insertions, 275 deletions
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(&params);
}
-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);