diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-12 16:26:11 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-12 16:26:11 +0000 |
commit | 128daf6bc3b24d366cf8f252ebe20f70818ea1b7 (patch) | |
tree | 8f6c4f5cf42904532664f7786857400be61251b7 /mojo/shell | |
parent | cd4186fcba54ce17d0c16467fdb8835286aa466f (diff) | |
download | chromium_src-128daf6bc3b24d366cf8f252ebe20f70818ea1b7.zip chromium_src-128daf6bc3b24d366cf8f252ebe20f70818ea1b7.tar.gz chromium_src-128daf6bc3b24d366cf8f252ebe20f70818ea1b7.tar.bz2 |
Create Application class
BUG=
R=darin@chromium.org
Review URL: https://codereview.chromium.org/135513008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250731 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/shell')
-rw-r--r-- | mojo/shell/android/mojo_main.cc | 8 | ||||
-rw-r--r-- | mojo/shell/service_connector.cc | 7 | ||||
-rw-r--r-- | mojo/shell/service_connector_unittest.cc | 9 |
3 files changed, 14 insertions, 10 deletions
diff --git a/mojo/shell/android/mojo_main.cc b/mojo/shell/android/mojo_main.cc index 127471e..122a525 100644 --- a/mojo/shell/android/mojo_main.cc +++ b/mojo/shell/android/mojo_main.cc @@ -12,7 +12,7 @@ #include "base/logging.h" #include "base/message_loop/message_loop.h" #include "jni/MojoMain_jni.h" -#include "mojo/public/shell/service.h" +#include "mojo/public/shell/application.h" #include "mojo/services/native_viewport/native_viewport_service.h" #include "mojo/shell/context.h" #include "mojo/shell/init.h" @@ -43,10 +43,10 @@ class NativeViewportServiceLoader : public shell::ServiceConnector::Loader { virtual void Load(const GURL& url, ScopedShellHandle service_handle) MOJO_OVERRIDE { - service_.reset(CreateNativeViewportService(g_context.Get().get(), - service_handle.Pass())); + app_.reset(CreateNativeViewportService(g_context.Get().get(), + service_handle.Pass())); } - scoped_ptr<ServiceFactoryBase> service_; + scoped_ptr<Application> app_; }; LazyInstance<scoped_ptr<NativeViewportServiceLoader> > diff --git a/mojo/shell/service_connector.cc b/mojo/shell/service_connector.cc index 2c2f0d0..d136b4d 100644 --- a/mojo/shell/service_connector.cc +++ b/mojo/shell/service_connector.cc @@ -5,6 +5,7 @@ #include "mojo/shell/service_connector.h" #include "base/logging.h" +#include "mojo/public/bindings/allocation_scope.h" #include "mojo/public/bindings/error_handler.h" #include "mojo/public/bindings/remote_ptr.h" #include "mojom/shell.h" @@ -24,8 +25,10 @@ class ServiceConnector::ServiceFactory : public Shell, public ErrorHandler { virtual ~ServiceFactory() {} void ConnectToClient(ScopedMessagePipeHandle handle) { - if (handle.is_valid()) - shell_client_->AcceptConnection(handle.Pass()); + if (handle.is_valid()) { + AllocationScope scope; + shell_client_->AcceptConnection(url_.spec(), handle.Pass()); + } } virtual void Connect(const String& url, diff --git a/mojo/shell/service_connector_unittest.cc b/mojo/shell/service_connector_unittest.cc index f007fed..3a264a2 100644 --- a/mojo/shell/service_connector_unittest.cc +++ b/mojo/shell/service_connector_unittest.cc @@ -5,7 +5,7 @@ #include "mojo/public/bindings/allocation_scope.h" #include "mojo/public/bindings/remote_ptr.h" #include "mojo/public/environment/environment.h" -#include "mojo/public/shell/service.h" +#include "mojo/public/shell/application.h" #include "mojo/public/utility/run_loop.h" #include "mojo/shell/service_connector.h" #include "mojom/shell.h" @@ -98,8 +98,9 @@ class ServiceConnectorTest : public testing::Test, virtual void Load(const GURL& url, ScopedShellHandle shell_handle) OVERRIDE { - test_app_.reset(new ServiceFactory<TestServiceImpl, TestContext>( - shell_handle.Pass(), &context_)); + test_app_.reset(new Application(shell_handle.Pass())); + test_app_->AddServiceFactory( + new ServiceFactory<TestServiceImpl, TestContext>(&context_)); } bool HasFactoryForTestURL() { @@ -111,7 +112,7 @@ class ServiceConnectorTest : public testing::Test, mojo::Environment env_; mojo::RunLoop loop_; TestContext context_; - scoped_ptr<ServiceFactory<TestServiceImpl, TestContext> > test_app_; + scoped_ptr<Application> test_app_; scoped_ptr<TestClientImpl> test_client_; scoped_ptr<ServiceConnector> service_connector_; DISALLOW_COPY_AND_ASSIGN(ServiceConnectorTest); |