| OLD | NEW |
| 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" |
| 11 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
| 12 #include "base/android/jni_string.h" | 12 #include "base/android/jni_string.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/scoped_native_library.h" | 15 #include "base/scoped_native_library.h" |
| 16 #include "jni/AndroidHandler_jni.h" | 16 #include "jni/AndroidHandler_jni.h" |
| 17 #include "mojo/common/data_pipe_utils.h" | 17 #include "mojo/common/data_pipe_utils.h" |
| 18 #include "mojo/public/c/system/main.h" | 18 #include "mojo/public/c/system/main.h" |
| 19 #include "mojo/shell/public/cpp/application_impl.h" | 19 #include "mojo/shell/public/cpp/shell.h" |
| 20 #include "mojo/shell/runner/host/native_application_support.h" | 20 #include "mojo/shell/runner/host/native_application_support.h" |
| 21 #include "mojo/shell/standalone/android/run_android_application_function.h" | 21 #include "mojo/shell/standalone/android/run_android_application_function.h" |
| 22 #include "mojo/util/filename_util.h" | 22 #include "mojo/util/filename_util.h" |
| 23 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 24 | 24 |
| 25 using base::android::AttachCurrentThread; | 25 using base::android::AttachCurrentThread; |
| 26 using base::android::ScopedJavaLocalRef; | 26 using base::android::ScopedJavaLocalRef; |
| 27 using base::android::ConvertJavaStringToUTF8; | 27 using base::android::ConvertJavaStringToUTF8; |
| 28 using base::android::ConvertUTF8ToJavaString; | 28 using base::android::ConvertUTF8ToJavaString; |
| 29 using base::android::GetApplicationContext; | 29 using base::android::GetApplicationContext; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 base::FilePath archive_path( | 159 base::FilePath archive_path( |
| 160 ConvertJavaStringToUTF8(env, j_archive_path.obj())); | 160 ConvertJavaStringToUTF8(env, j_archive_path.obj())); |
| 161 | 161 |
| 162 common::BlockingCopyToFile(std::move(response->body), archive_path); | 162 common::BlockingCopyToFile(std::move(response->body), archive_path); |
| 163 Java_AndroidHandler_bootstrap( | 163 Java_AndroidHandler_bootstrap( |
| 164 env, GetApplicationContext(), j_archive_path.obj(), | 164 env, GetApplicationContext(), j_archive_path.obj(), |
| 165 application_request.PassMessagePipe().release().value(), | 165 application_request.PassMessagePipe().release().value(), |
| 166 reinterpret_cast<jlong>(run_android_application_fn)); | 166 reinterpret_cast<jlong>(run_android_application_fn)); |
| 167 } | 167 } |
| 168 | 168 |
| 169 void AndroidHandler::Initialize(ApplicationImpl* app) {} | 169 void AndroidHandler::Initialize(Shell* shell, |
| 170 const std::string& url, |
| 171 uint32_t id) {} |
| 170 | 172 |
| 171 bool AndroidHandler::AcceptConnection(ApplicationConnection* connection) { | 173 bool AndroidHandler::AcceptConnection(ApplicationConnection* connection) { |
| 172 connection->AddService(&content_handler_factory_); | 174 connection->AddService(&content_handler_factory_); |
| 173 return true; | 175 return true; |
| 174 } | 176 } |
| 175 | 177 |
| 176 bool RegisterAndroidHandlerJni(JNIEnv* env) { | 178 bool RegisterAndroidHandlerJni(JNIEnv* env) { |
| 177 return RegisterNativesImpl(env); | 179 return RegisterNativesImpl(env); |
| 178 } | 180 } |
| 179 | 181 |
| 180 } // namespace shell | 182 } // namespace shell |
| 181 } // namespace mojo | 183 } // namespace mojo |
| OLD | NEW |