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

Side by Side Diff: mojo/runner/android/android_handler.cc

Issue 1107233002: Move runner stuff into a runner namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 7 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
« no previous file with comments | « mojo/runner/android/android_handler.h ('k') | mojo/runner/android/android_handler_loader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/runner/android/android_handler.h" 5 #include "mojo/runner/android/android_handler.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/scoped_native_library.h" 11 #include "base/scoped_native_library.h"
12 #include "jni/AndroidHandler_jni.h" 12 #include "jni/AndroidHandler_jni.h"
13 #include "mojo/common/data_pipe_utils.h" 13 #include "mojo/common/data_pipe_utils.h"
14 #include "mojo/public/c/system/main.h" 14 #include "mojo/public/c/system/main.h"
15 #include "mojo/public/cpp/application/application_impl.h" 15 #include "mojo/public/cpp/application/application_impl.h"
16 #include "mojo/runner/android/run_android_application_function.h" 16 #include "mojo/runner/android/run_android_application_function.h"
17 #include "mojo/runner/native_application_support.h" 17 #include "mojo/runner/native_application_support.h"
18 18
19 using base::android::AttachCurrentThread; 19 using base::android::AttachCurrentThread;
20 using base::android::ScopedJavaLocalRef; 20 using base::android::ScopedJavaLocalRef;
21 using base::android::ConvertJavaStringToUTF8; 21 using base::android::ConvertJavaStringToUTF8;
22 using base::android::ConvertUTF8ToJavaString; 22 using base::android::ConvertUTF8ToJavaString;
23 using base::android::GetApplicationContext; 23 using base::android::GetApplicationContext;
24 24
25 namespace mojo { 25 namespace mojo {
26 namespace shell { 26 namespace runner {
27 27
28 namespace { 28 namespace {
29 29
30 // This function loads the application library, sets the application context and 30 // This function loads the application library, sets the application context and
31 // thunks and calls into the application MojoMain. To ensure that the thunks are 31 // thunks and calls into the application MojoMain. To ensure that the thunks are
32 // set correctly we keep it in the Mojo shell .so and pass the function pointer 32 // set correctly we keep it in the Mojo shell .so and pass the function pointer
33 // to the helper libbootstrap.so. 33 // to the helper libbootstrap.so.
34 void RunAndroidApplication(JNIEnv* env, 34 void RunAndroidApplication(JNIEnv* env,
35 jobject j_context, 35 jobject j_context,
36 const base::FilePath& app_path, 36 const base::FilePath& app_path,
37 jint j_handle) { 37 jint j_handle) {
38 InterfaceRequest<Application> application_request = 38 InterfaceRequest<Application> application_request =
39 MakeRequest<Application>(MakeScopedHandle(MessagePipeHandle(j_handle))); 39 MakeRequest<Application>(MakeScopedHandle(MessagePipeHandle(j_handle)));
40 40
41 // Load the library, so that we can set the application context there if 41 // Load the library, so that we can set the application context there if
42 // needed. 42 // needed.
43 // TODO(vtl): We'd use a ScopedNativeLibrary, but it doesn't have .get()! 43 // TODO(vtl): We'd use a ScopedNativeLibrary, but it doesn't have .get()!
44 base::NativeLibrary app_library = 44 base::NativeLibrary app_library =
45 LoadNativeApplication(app_path, NativeApplicationCleanup::DELETE); 45 LoadNativeApplication(app_path, shell::NativeApplicationCleanup::DELETE);
46 if (!app_library) 46 if (!app_library)
47 return; 47 return;
48 48
49 // Set the application context if needed. Most applications will need to 49 // Set the application context if needed. Most applications will need to
50 // access the Android ApplicationContext in which they are run. If the 50 // access the Android ApplicationContext in which they are run. If the
51 // application library exports the InitApplicationContext function, we will 51 // application library exports the InitApplicationContext function, we will
52 // set it there. 52 // set it there.
53 const char* init_application_context_name = "InitApplicationContext"; 53 const char* init_application_context_name = "InitApplicationContext";
54 typedef void (*InitApplicationContextFn)( 54 typedef void (*InitApplicationContextFn)(
55 const base::android::JavaRef<jobject>&); 55 const base::android::JavaRef<jobject>&);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 bool AndroidHandler::ConfigureIncomingConnection( 100 bool AndroidHandler::ConfigureIncomingConnection(
101 ApplicationConnection* connection) { 101 ApplicationConnection* connection) {
102 connection->AddService(&content_handler_factory_); 102 connection->AddService(&content_handler_factory_);
103 return true; 103 return true;
104 } 104 }
105 105
106 bool RegisterAndroidHandlerJni(JNIEnv* env) { 106 bool RegisterAndroidHandlerJni(JNIEnv* env) {
107 return RegisterNativesImpl(env); 107 return RegisterNativesImpl(env);
108 } 108 }
109 109
110 } // namespace shell 110 } // namespace runner
111 } // namespace mojo 111 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/runner/android/android_handler.h ('k') | mojo/runner/android/android_handler_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698