Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1079)

Unified Diff: mojo/shell/android/mojo_main.cc

Issue 93793009: Implement ServiceManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Allow Android to be built Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/services/native_viewport/native_viewport_service.cc ('k') | mojo/shell/app_container.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/android/mojo_main.cc
diff --git a/mojo/shell/android/mojo_main.cc b/mojo/shell/android/mojo_main.cc
index d0701658a2d3f6a3d9187a2923e963367fed45c1..64de60f65a3c9e603fc993c3fdbc8fc0beeb27f0 100644
--- a/mojo/shell/android/mojo_main.cc
+++ b/mojo/shell/android/mojo_main.cc
@@ -12,9 +12,11 @@
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "jni/MojoMain_jni.h"
+#include "mojo/services/native_viewport/native_viewport_service.h"
#include "mojo/shell/context.h"
#include "mojo/shell/init.h"
#include "mojo/shell/run.h"
+#include "mojo/shell/service_manager.h"
#include "ui/gl/gl_surface_egl.h"
using base::LazyInstance;
@@ -31,6 +33,25 @@ LazyInstance<scoped_ptr<base::MessageLoop> > g_java_message_loop =
LazyInstance<scoped_ptr<shell::Context> > g_context =
LAZY_INSTANCE_INITIALIZER;
+class NativeViewportServiceLoader : public shell::ServiceManager::Loader {
+ public:
+ NativeViewportServiceLoader() {}
+ virtual ~NativeViewportServiceLoader() {}
+
+ private:
+ virtual void Load(const GURL& url,
+ shell::ServiceManager* manager,
+ ScopedMessagePipeHandle service_handle)
+ MOJO_OVERRIDE {
+ service_.reset(CreateNativeViewportService(service_handle.Pass()));
+ service_->set_context(g_context.Get().get());
+ }
+ scoped_ptr<services::NativeViewportService> service_;
+};
+
+LazyInstance<scoped_ptr<NativeViewportServiceLoader> >
+ g_viewport_service_loader = LAZY_INSTANCE_INITIALIZER;
+
} // namspace
static void Init(JNIEnv* env, jclass clazz, jobject context) {
@@ -61,7 +82,7 @@ static void Start(JNIEnv* env, jclass clazz, jobject context, jstring jurl) {
std::string app_url = base::android::ConvertJavaStringToUTF8(env, jurl);
std::vector<std::string> argv;
argv.push_back("mojo_shell");
- argv.push_back("--app=" + app_url);
+ argv.push_back(app_url);
CommandLine::ForCurrentProcess()->InitFromArgv(argv);
}
@@ -70,6 +91,11 @@ static void Start(JNIEnv* env, jclass clazz, jobject context, jstring jurl) {
shell::Context* shell_context = new shell::Context();
shell_context->set_activity(activity.obj());
+ g_viewport_service_loader.Get().reset(new NativeViewportServiceLoader());
+ shell_context->service_manager()->SetLoaderForURL(
+ g_viewport_service_loader.Get().get(),
+ GURL("mojo:mojo_native_viewport_service"));
+
g_context.Get().reset(shell_context);
shell::Run(shell_context);
}
« no previous file with comments | « mojo/services/native_viewport/native_viewport_service.cc ('k') | mojo/shell/app_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698