| 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/android/java_handler.h" | 5 #include "services/android/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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 tracing_.Initialize(app); | 95 tracing_.Initialize(app); |
| 96 handler_task_runner_ = base::MessageLoop::current()->task_runner(); | 96 handler_task_runner_ = base::MessageLoop::current()->task_runner(); |
| 97 app->ConnectToService("mojo:url_response_disk_cache", | 97 app->ConnectToService("mojo:url_response_disk_cache", |
| 98 &url_response_disk_cache_); | 98 &url_response_disk_cache_); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void JavaHandler::GetApplication(base::FilePath* archive_path, | 101 void JavaHandler::GetApplication(base::FilePath* archive_path, |
| 102 base::FilePath* cache_dir, | 102 base::FilePath* cache_dir, |
| 103 mojo::URLResponsePtr response, | 103 mojo::URLResponsePtr response, |
| 104 const base::Closure& callback) { | 104 const base::Closure& callback) { |
| 105 url_response_disk_cache_->GetFile( | 105 url_response_disk_cache_->UpdateAndGet( |
| 106 response.Pass(), | 106 response.Pass(), |
| 107 [archive_path, cache_dir, callback](mojo::Array<uint8_t> extracted_path, | 107 [archive_path, cache_dir, callback](mojo::Array<uint8_t> extracted_path, |
| 108 mojo::Array<uint8_t> cache_path) { | 108 mojo::Array<uint8_t> cache_path) { |
| 109 if (extracted_path.is_null()) { | 109 if (extracted_path.is_null()) { |
| 110 *archive_path = base::FilePath(); | 110 *archive_path = base::FilePath(); |
| 111 *cache_dir = base::FilePath(); | 111 *cache_dir = base::FilePath(); |
| 112 } else { | 112 } else { |
| 113 *archive_path = base::FilePath( | 113 *archive_path = base::FilePath( |
| 114 std::string(reinterpret_cast<char*>(&extracted_path.front()), | 114 std::string(reinterpret_cast<char*>(&extracted_path.front()), |
| 115 extracted_path.size())); | 115 extracted_path.size())); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 155 } |
| 156 | 156 |
| 157 // This is needed because the application needs to access the application | 157 // This is needed because the application needs to access the application |
| 158 // context. | 158 // context. |
| 159 extern "C" JNI_EXPORT void InitApplicationContext( | 159 extern "C" JNI_EXPORT void InitApplicationContext( |
| 160 const base::android::JavaRef<jobject>& context) { | 160 const base::android::JavaRef<jobject>& context) { |
| 161 JNIEnv* env = base::android::AttachCurrentThread(); | 161 JNIEnv* env = base::android::AttachCurrentThread(); |
| 162 base::android::InitApplicationContext(env, context); | 162 base::android::InitApplicationContext(env, context); |
| 163 } | 163 } |
| 164 | 164 |
| OLD | NEW |