| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/android/webapk/webapk_installer.h" | 5 #include "chrome/browser/android/webapk/webapk_installer.h" |
| 6 | 6 |
| 7 #include "base/android/build_info.h" | 7 #include "base/android/build_info.h" |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/path_utils.h" | 10 #include "base/android/path_utils.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 void WebApkInstaller::SetTimeoutMs(int timeout_ms) { | 135 void WebApkInstaller::SetTimeoutMs(int timeout_ms) { |
| 136 webapk_download_url_timeout_ms_ = timeout_ms; | 136 webapk_download_url_timeout_ms_ = timeout_ms; |
| 137 download_timeout_ms_ = timeout_ms; | 137 download_timeout_ms_ = timeout_ms; |
| 138 } | 138 } |
| 139 | 139 |
| 140 bool WebApkInstaller::StartDownloadedWebApkInstall( | 140 bool WebApkInstaller::StartDownloadedWebApkInstall( |
| 141 JNIEnv* env, | 141 JNIEnv* env, |
| 142 const base::android::ScopedJavaLocalRef<jstring>& java_file_path, | 142 const base::android::ScopedJavaLocalRef<jstring>& java_file_path, |
| 143 const base::android::ScopedJavaLocalRef<jstring>& java_package_name) { | 143 const base::android::ScopedJavaLocalRef<jstring>& java_package_name) { |
| 144 return Java_WebApkInstaller_installAsyncFromNative(env, java_file_path.obj(), | 144 return Java_WebApkInstaller_installAsyncFromNative(env, java_file_path, |
| 145 java_package_name.obj()); | 145 java_package_name); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void WebApkInstaller::OnURLFetchComplete(const net::URLFetcher* source) { | 148 void WebApkInstaller::OnURLFetchComplete(const net::URLFetcher* source) { |
| 149 timer_.Stop(); | 149 timer_.Stop(); |
| 150 | 150 |
| 151 if (!source->GetStatus().is_success() || | 151 if (!source->GetStatus().is_success() || |
| 152 source->GetResponseCode() != net::HTTP_OK) { | 152 source->GetResponseCode() != net::HTTP_OK) { |
| 153 OnFailure(); | 153 OnFailure(); |
| 154 return; | 154 return; |
| 155 } | 155 } |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 294 |
| 295 void WebApkInstaller::OnSuccess() { | 295 void WebApkInstaller::OnSuccess() { |
| 296 finish_callback_.Run(true); | 296 finish_callback_.Run(true); |
| 297 delete this; | 297 delete this; |
| 298 } | 298 } |
| 299 | 299 |
| 300 void WebApkInstaller::OnFailure() { | 300 void WebApkInstaller::OnFailure() { |
| 301 finish_callback_.Run(false); | 301 finish_callback_.Run(false); |
| 302 delete this; | 302 delete this; |
| 303 } | 303 } |
| OLD | NEW |