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 72 matching lines...) Loading... |
83 ScopedJavaLocalRef<jstring> j_archive_path = | 83 ScopedJavaLocalRef<jstring> j_archive_path = |
84 ConvertUTF8ToJavaString(env, archive_path.value()); | 84 ConvertUTF8ToJavaString(env, archive_path.value()); |
85 ScopedJavaLocalRef<jstring> j_cache_dir = | 85 ScopedJavaLocalRef<jstring> j_cache_dir = |
86 ConvertUTF8ToJavaString(env, cache_dir.value()); | 86 ConvertUTF8ToJavaString(env, cache_dir.value()); |
87 Java_JavaHandler_bootstrap( | 87 Java_JavaHandler_bootstrap( |
88 env, context, j_archive_path.obj(), j_cache_dir.obj(), | 88 env, context, j_archive_path.obj(), j_cache_dir.obj(), |
89 application_request.PassMessagePipe().release().value()); | 89 application_request.PassMessagePipe().release().value()); |
90 } | 90 } |
91 | 91 |
92 void JavaHandler::Initialize(mojo::ApplicationImpl* app) { | 92 void JavaHandler::Initialize(mojo::ApplicationImpl* app) { |
93 tracing_.Initialize(app); | 93 tracing_.Initialize(app->shell(), &app->args()); |
94 handler_task_runner_ = base::MessageLoop::current()->task_runner(); | 94 handler_task_runner_ = base::MessageLoop::current()->task_runner(); |
95 mojo::ConnectToService(app->shell(), "mojo:url_response_disk_cache", | 95 mojo::ConnectToService(app->shell(), "mojo:url_response_disk_cache", |
96 GetProxy(&url_response_disk_cache_)); | 96 GetProxy(&url_response_disk_cache_)); |
97 } | 97 } |
98 | 98 |
99 void JavaHandler::GetApplication(base::FilePath* archive_path, | 99 void JavaHandler::GetApplication(base::FilePath* archive_path, |
100 base::FilePath* cache_dir, | 100 base::FilePath* cache_dir, |
101 mojo::URLResponsePtr response, | 101 mojo::URLResponsePtr response, |
102 const base::Closure& callback) { | 102 const base::Closure& callback) { |
103 url_response_disk_cache_->UpdateAndGet( | 103 url_response_disk_cache_->UpdateAndGet( |
(...skipping 49 matching lines...) Loading... |
153 return JNI_VERSION_1_4; | 153 return JNI_VERSION_1_4; |
154 } | 154 } |
155 | 155 |
156 // This is needed because the application needs to access the application | 156 // This is needed because the application needs to access the application |
157 // context. | 157 // context. |
158 extern "C" JNI_EXPORT void InitApplicationContext( | 158 extern "C" JNI_EXPORT void InitApplicationContext( |
159 const base::android::JavaRef<jobject>& context) { | 159 const base::android::JavaRef<jobject>& context) { |
160 JNIEnv* env = base::android::AttachCurrentThread(); | 160 JNIEnv* env = base::android::AttachCurrentThread(); |
161 base::android::InitApplicationContext(env, context); | 161 base::android::InitApplicationContext(env, context); |
162 } | 162 } |
OLD | NEW |