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

Side by Side Diff: mojo/shell/android/mojo_main.cc

Issue 214513009: Change ServiceManager::SetLoaderForUrl() to SetLoaderForScheme() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Leave GetLoaderForURL() as is Created 6 years, 9 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/shell/android/mojo_main.h" 5 #include "mojo/shell/android/mojo_main.h"
6 6
7 #include "base/android/jni_string.h" 7 #include "base/android/jni_string.h"
8 #include "base/at_exit.h" 8 #include "base/at_exit.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 16 matching lines...) Expand all
27 namespace mojo { 27 namespace mojo {
28 28
29 namespace { 29 namespace {
30 30
31 LazyInstance<scoped_ptr<base::MessageLoop> > g_java_message_loop = 31 LazyInstance<scoped_ptr<base::MessageLoop> > g_java_message_loop =
32 LAZY_INSTANCE_INITIALIZER; 32 LAZY_INSTANCE_INITIALIZER;
33 33
34 LazyInstance<scoped_ptr<shell::Context> > g_context = 34 LazyInstance<scoped_ptr<shell::Context> > g_context =
35 LAZY_INSTANCE_INITIALIZER; 35 LAZY_INSTANCE_INITIALIZER;
36 36
37 const char kNativeViewportServiceUrl[] = "mojo:mojo_native_viewport_service";
38
37 class NativeViewportServiceLoader : public ServiceLoader { 39 class NativeViewportServiceLoader : public ServiceLoader {
38 public: 40 public:
39 NativeViewportServiceLoader() {} 41 NativeViewportServiceLoader() {}
40 virtual ~NativeViewportServiceLoader() {} 42 virtual ~NativeViewportServiceLoader() {}
41 43
42 private: 44 private:
43 virtual void LoadService(ServiceManager* manager, 45 virtual void LoadService(ServiceManager* manager,
44 const GURL& url, 46 const GURL& url,
45 ScopedShellHandle service_handle) OVERRIDE { 47 ScopedShellHandle service_handle) OVERRIDE {
48 DCHECK_EQ(url.spec(), kNativeViewportServiceUrl);
46 app_.reset(CreateNativeViewportService(g_context.Get().get(), 49 app_.reset(CreateNativeViewportService(g_context.Get().get(),
47 service_handle.Pass())); 50 service_handle.Pass()));
48 } 51 }
49 52
50 virtual void OnServiceError(ServiceManager* manager, 53 virtual void OnServiceError(ServiceManager* manager,
51 const GURL& url) OVERRIDE { 54 const GURL& url) OVERRIDE {
52 } 55 }
53 56
54 scoped_ptr<Application> app_; 57 scoped_ptr<Application> app_;
55 }; 58 };
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 argv.push_back(app_url); 95 argv.push_back(app_url);
93 CommandLine::ForCurrentProcess()->InitFromArgv(argv); 96 CommandLine::ForCurrentProcess()->InitFromArgv(argv);
94 } 97 }
95 98
96 base::android::ScopedJavaGlobalRef<jobject> activity; 99 base::android::ScopedJavaGlobalRef<jobject> activity;
97 activity.Reset(env, context); 100 activity.Reset(env, context);
98 101
99 shell::Context* shell_context = new shell::Context(); 102 shell::Context* shell_context = new shell::Context();
100 shell_context->set_activity(activity.obj()); 103 shell_context->set_activity(activity.obj());
101 g_viewport_service_loader.Get().reset(new NativeViewportServiceLoader()); 104 g_viewport_service_loader.Get().reset(new NativeViewportServiceLoader());
102 shell_context->service_manager()->SetLoaderForURL( 105 shell_context->service_manager()->SetLoaderForScheme(
103 g_viewport_service_loader.Get().get(), 106 g_viewport_service_loader.Get().get(),
104 GURL("mojo:mojo_native_viewport_service")); 107 "mojo");
105 108
106 g_context.Get().reset(shell_context); 109 g_context.Get().reset(shell_context);
107 shell::Run(shell_context); 110 shell::Run(shell_context);
108 } 111 }
109 112
110 bool RegisterMojoMain(JNIEnv* env) { 113 bool RegisterMojoMain(JNIEnv* env) {
111 return RegisterNativesImpl(env); 114 return RegisterNativesImpl(env);
112 } 115 }
113 116
114 } // namespace mojo 117 } // namespace mojo
OLDNEW
« mojo/service_manager/service_manager.h ('K') | « mojo/service_manager/service_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698