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

Side by Side Diff: mojo/shell/standalone/android/android_handler.cc

Issue 1679573002: Move shell interfaces into the shell.mojom namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delegate
Patch Set: . Created 4 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/standalone/android/android_handler.h" 5 #include "mojo/shell/standalone/android/android_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/android/context_utils.h" 10 #include "base/android/context_utils.h"
(...skipping 23 matching lines...) Expand all
34 namespace { 34 namespace {
35 35
36 // This function loads the application library, sets the application context and 36 // This function loads the application library, sets the application context and
37 // thunks and calls into the application MojoMain. To ensure that the thunks are 37 // thunks and calls into the application MojoMain. To ensure that the thunks are
38 // set correctly we keep it in the Mojo shell .so and pass the function pointer 38 // set correctly we keep it in the Mojo shell .so and pass the function pointer
39 // to the helper libbootstrap.so. 39 // to the helper libbootstrap.so.
40 void RunAndroidApplication(JNIEnv* env, 40 void RunAndroidApplication(JNIEnv* env,
41 jobject j_context, 41 jobject j_context,
42 const base::FilePath& app_path, 42 const base::FilePath& app_path,
43 jint j_handle) { 43 jint j_handle) {
44 InterfaceRequest<Application> application_request = 44 InterfaceRequest<mojom::Application> application_request =
45 MakeRequest<Application>(MakeScopedHandle(MessagePipeHandle(j_handle))); 45 MakeRequest<mojom::Application>(
46 MakeScopedHandle(MessagePipeHandle(j_handle)));
46 47
47 // Load the library, so that we can set the application context there if 48 // Load the library, so that we can set the application context there if
48 // needed. 49 // needed.
49 // TODO(vtl): We'd use a ScopedNativeLibrary, but it doesn't have .get()! 50 // TODO(vtl): We'd use a ScopedNativeLibrary, but it doesn't have .get()!
50 base::NativeLibrary app_library = LoadNativeApplication(app_path); 51 base::NativeLibrary app_library = LoadNativeApplication(app_path);
51 if (!app_library) 52 if (!app_library)
52 return; 53 return;
53 54
54 // Set the application context if needed. Most applications will need to 55 // Set the application context if needed. Most applications will need to
55 // access the Android ApplicationContext in which they are run. If the 56 // access the Android ApplicationContext in which they are run. If the
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return true; 126 return true;
126 } 127 }
127 128
128 } // namespace 129 } // namespace
129 130
130 AndroidHandler::AndroidHandler() : content_handler_factory_(this) {} 131 AndroidHandler::AndroidHandler() : content_handler_factory_(this) {}
131 132
132 AndroidHandler::~AndroidHandler() {} 133 AndroidHandler::~AndroidHandler() {}
133 134
134 void AndroidHandler::RunApplication( 135 void AndroidHandler::RunApplication(
135 InterfaceRequest<Application> application_request, 136 InterfaceRequest<mojom::Application> application_request,
136 URLResponsePtr response) { 137 URLResponsePtr response) {
137 JNIEnv* env = AttachCurrentThread(); 138 JNIEnv* env = AttachCurrentThread();
138 RunAndroidApplicationFn run_android_application_fn = &RunAndroidApplication; 139 RunAndroidApplicationFn run_android_application_fn = &RunAndroidApplication;
139 if (!response->url.is_null()) { 140 if (!response->url.is_null()) {
140 base::FilePath internal_app_path; 141 base::FilePath internal_app_path;
141 base::FilePath path_to_mojo; 142 base::FilePath path_to_mojo;
142 if (IsCachedApp(env, GURL(response->url.get()), &internal_app_path, 143 if (IsCachedApp(env, GURL(response->url.get()), &internal_app_path,
143 &path_to_mojo)) { 144 &path_to_mojo)) {
144 ScopedJavaLocalRef<jstring> j_internal_app_path( 145 ScopedJavaLocalRef<jstring> j_internal_app_path(
145 ConvertUTF8ToJavaString(env, internal_app_path.value())); 146 ConvertUTF8ToJavaString(env, internal_app_path.value()));
(...skipping 25 matching lines...) Expand all
171 connection->AddService(&content_handler_factory_); 172 connection->AddService(&content_handler_factory_);
172 return true; 173 return true;
173 } 174 }
174 175
175 bool RegisterAndroidHandlerJni(JNIEnv* env) { 176 bool RegisterAndroidHandlerJni(JNIEnv* env) {
176 return RegisterNativesImpl(env); 177 return RegisterNativesImpl(env);
177 } 178 }
178 179
179 } // namespace shell 180 } // namespace shell
180 } // namespace mojo 181 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/standalone/android/android_handler.h ('k') | mojo/shell/standalone/android/android_handler_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698