| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // Calls the callback when the |webapk| request is created. | 173 // Calls the callback when the |webapk| request is created. |
| 174 void OnWebApkProtoBuilt( | 174 void OnWebApkProtoBuilt( |
| 175 const base::Callback<void(std::unique_ptr<webapk::WebApk>)>& callback, | 175 const base::Callback<void(std::unique_ptr<webapk::WebApk>)>& callback, |
| 176 std::unique_ptr<webapk::WebApk> webapk) { | 176 std::unique_ptr<webapk::WebApk> webapk) { |
| 177 callback.Run(std::move(webapk)); | 177 callback.Run(std::move(webapk)); |
| 178 } | 178 } |
| 179 | 179 |
| 180 // Returns task runner for running background tasks. | 180 // Returns task runner for running background tasks. |
| 181 scoped_refptr<base::TaskRunner> GetBackgroundTaskRunner() { | 181 scoped_refptr<base::TaskRunner> GetBackgroundTaskRunner() { |
| 182 return base::CreateTaskRunnerWithTraits( | 182 return base::CreateTaskRunnerWithTraits( |
| 183 base::TaskTraits() | 183 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
| 184 .MayBlock() | 184 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}); |
| 185 .WithPriority(base::TaskPriority::BACKGROUND) | |
| 186 .WithShutdownBehavior(base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)); | |
| 187 } | 185 } |
| 188 | 186 |
| 189 } // anonymous namespace | 187 } // anonymous namespace |
| 190 | 188 |
| 191 WebApkInstaller::~WebApkInstaller() { | 189 WebApkInstaller::~WebApkInstaller() { |
| 192 JNIEnv* env = base::android::AttachCurrentThread(); | 190 JNIEnv* env = base::android::AttachCurrentThread(); |
| 193 Java_WebApkInstaller_destroy(env, java_ref_); | 191 Java_WebApkInstaller_destroy(env, java_ref_); |
| 194 java_ref_.Reset(); | 192 java_ref_.Reset(); |
| 195 } | 193 } |
| 196 | 194 |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 net::URLFetcher::Create(server_url, net::URLFetcher::POST, this); | 498 net::URLFetcher::Create(server_url, net::URLFetcher::POST, this); |
| 501 url_fetcher_->SetRequestContext(request_context_getter_); | 499 url_fetcher_->SetRequestContext(request_context_getter_); |
| 502 std::string serialized_request; | 500 std::string serialized_request; |
| 503 request_proto->SerializeToString(&serialized_request); | 501 request_proto->SerializeToString(&serialized_request); |
| 504 url_fetcher_->SetUploadData(kProtoMimeType, serialized_request); | 502 url_fetcher_->SetUploadData(kProtoMimeType, serialized_request); |
| 505 url_fetcher_->SetLoadFlags( | 503 url_fetcher_->SetLoadFlags( |
| 506 net::LOAD_DISABLE_CACHE | net::LOAD_DO_NOT_SEND_COOKIES | | 504 net::LOAD_DISABLE_CACHE | net::LOAD_DO_NOT_SEND_COOKIES | |
| 507 net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_AUTH_DATA); | 505 net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_AUTH_DATA); |
| 508 url_fetcher_->Start(); | 506 url_fetcher_->Start(); |
| 509 } | 507 } |
| OLD | NEW |