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 "services/java_handler/java_handler.h" | 5 #include "services/java_handler/java_handler.h" |
6 | 6 |
7 #include "base/android/base_jni_onload.h" | 7 #include "base/android/base_jni_onload.h" |
8 #include "base/android/base_jni_registrar.h" | 8 #include "base/android/base_jni_registrar.h" |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 ScopedJavaLocalRef<jstring> j_cache_dir = | 84 ScopedJavaLocalRef<jstring> j_cache_dir = |
85 ConvertUTF8ToJavaString(env, cache_dir.value()); | 85 ConvertUTF8ToJavaString(env, cache_dir.value()); |
86 Java_JavaHandler_bootstrap( | 86 Java_JavaHandler_bootstrap( |
87 env, context, j_archive_path.obj(), j_cache_dir.obj(), | 87 env, context, j_archive_path.obj(), j_cache_dir.obj(), |
88 application_request.PassMessagePipe().release().value()); | 88 application_request.PassMessagePipe().release().value()); |
89 } | 89 } |
90 | 90 |
91 void JavaHandler::Initialize(mojo::ApplicationImpl* app) { | 91 void JavaHandler::Initialize(mojo::ApplicationImpl* app) { |
92 tracing_.Initialize(app); | 92 tracing_.Initialize(app); |
93 handler_task_runner_ = base::MessageLoop::current()->task_runner(); | 93 handler_task_runner_ = base::MessageLoop::current()->task_runner(); |
94 app->ConnectToService("mojo:url_response_disk_cache", | 94 app->ConnectToServiceDeprecated("mojo:url_response_disk_cache", |
95 &url_response_disk_cache_); | 95 &url_response_disk_cache_); |
96 } | 96 } |
97 | 97 |
98 void JavaHandler::GetApplication(base::FilePath* archive_path, | 98 void JavaHandler::GetApplication(base::FilePath* archive_path, |
99 base::FilePath* cache_dir, | 99 base::FilePath* cache_dir, |
100 mojo::URLResponsePtr response, | 100 mojo::URLResponsePtr response, |
101 const base::Closure& callback) { | 101 const base::Closure& callback) { |
102 url_response_disk_cache_->UpdateAndGet( | 102 url_response_disk_cache_->UpdateAndGet( |
103 response.Pass(), | 103 response.Pass(), |
104 [archive_path, cache_dir, callback](mojo::Array<uint8_t> extracted_path, | 104 [archive_path, cache_dir, callback](mojo::Array<uint8_t> extracted_path, |
105 mojo::Array<uint8_t> cache_path) { | 105 mojo::Array<uint8_t> cache_path) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 return JNI_VERSION_1_4; | 151 return JNI_VERSION_1_4; |
152 } | 152 } |
153 | 153 |
154 // This is needed because the application needs to access the application | 154 // This is needed because the application needs to access the application |
155 // context. | 155 // context. |
156 extern "C" JNI_EXPORT void InitApplicationContext( | 156 extern "C" JNI_EXPORT void InitApplicationContext( |
157 const base::android::JavaRef<jobject>& context) { | 157 const base::android::JavaRef<jobject>& context) { |
158 JNIEnv* env = base::android::AttachCurrentThread(); | 158 JNIEnv* env = base::android::AttachCurrentThread(); |
159 base::android::InitApplicationContext(env, context); | 159 base::android::InitApplicationContext(env, context); |
160 } | 160 } |
OLD | NEW |