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

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

Issue 972433004: Use the mojo::shell namespace consistently underly shell/. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Java! Created 5 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
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 "shell/android/android_handler.h" 5 #include "shell/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 "shell/android/run_android_application_function.h" 16 #include "shell/android/run_android_application_function.h"
17 #include "shell/dynamic_service_runner.h" 17 #include "shell/dynamic_service_runner.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 27
27 namespace { 28 namespace {
28 29
29 // This function loads the application library, sets the application context and 30 // This function loads the application library, sets the application context and
30 // 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
31 // 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
32 // to the helper libbootstrap.so. 33 // to the helper libbootstrap.so.
33 void RunAndroidApplication(JNIEnv* env, 34 void RunAndroidApplication(JNIEnv* env,
34 jobject j_context, 35 jobject j_context,
35 const base::FilePath& app_path, 36 const base::FilePath& app_path,
(...skipping 21 matching lines...) Expand all
57 const base::android::JavaRef<jobject>&); 58 const base::android::JavaRef<jobject>&);
58 InitApplicationContextFn init_application_context = 59 InitApplicationContextFn init_application_context =
59 reinterpret_cast<InitApplicationContextFn>( 60 reinterpret_cast<InitApplicationContextFn>(
60 app_library.GetFunctionPointer(init_application_context_name)); 61 app_library.GetFunctionPointer(init_application_context_name));
61 if (init_application_context) { 62 if (init_application_context) {
62 base::android::ScopedJavaLocalRef<jobject> scoped_context(env, j_context); 63 base::android::ScopedJavaLocalRef<jobject> scoped_context(env, j_context);
63 init_application_context(scoped_context); 64 init_application_context(scoped_context);
64 } 65 }
65 66
66 // Run the application. 67 // Run the application.
67 base::ScopedNativeLibrary app_library_from_runner( 68 base::ScopedNativeLibrary app_library_from_runner(LoadAndRunNativeApplication(
68 shell::LoadAndRunNativeApplication(app_path, NativeRunner::DeleteAppPath, 69 app_path, NativeRunner::DeleteAppPath, application_request.Pass()));
69 application_request.Pass()));
70 } 70 }
71 71
72 } // namespace 72 } // namespace
73 73
74 AndroidHandler::AndroidHandler() : content_handler_factory_(this) { 74 AndroidHandler::AndroidHandler() : content_handler_factory_(this) {
75 } 75 }
76 76
77 AndroidHandler::~AndroidHandler() { 77 AndroidHandler::~AndroidHandler() {
78 } 78 }
79 79
(...skipping 20 matching lines...) Expand all
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 mojo 111 } // namespace mojo
OLDNEW
« no previous file with comments | « shell/android/android_handler.h ('k') | shell/android/apk/src/org/chromium/mojo/shell/AndroidHandler.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698