| 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 18 matching lines...) Expand all Loading... |
| 29 #include "jni/WebApkInstaller_jni.h" | 29 #include "jni/WebApkInstaller_jni.h" |
| 30 #include "net/http/http_status_code.h" | 30 #include "net/http/http_status_code.h" |
| 31 #include "net/url_request/url_fetcher.h" | 31 #include "net/url_request/url_fetcher.h" |
| 32 #include "ui/gfx/codec/png_codec.h" | 32 #include "ui/gfx/codec/png_codec.h" |
| 33 #include "url/gurl.h" | 33 #include "url/gurl.h" |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 // The default WebAPK server URL. | 37 // The default WebAPK server URL. |
| 38 const char kDefaultServerUrl[] = | 38 const char kDefaultServerUrl[] = |
| 39 "https://test-webapk.sandbox.googleapis.com/v1/webApks/?alt=proto&key=AIzaSy
AoI6v-F31-3t9NunLYEiKcPIqgTJIUZBw"; | 39 "https://webapk.googleapis.com/v1/webApks/?alt=proto&key=AIzaSyAoI6v-F31-3t9
NunLYEiKcPIqgTJIUZBw"; |
| 40 | 40 |
| 41 // The MIME type of the POST data sent to the server. | 41 // The MIME type of the POST data sent to the server. |
| 42 const char kProtoMimeType[] = "application/x-protobuf"; | 42 const char kProtoMimeType[] = "application/x-protobuf"; |
| 43 | 43 |
| 44 // The default number of milliseconds to wait for the WebAPK download URL from | 44 // The default number of milliseconds to wait for the WebAPK download URL from |
| 45 // the WebAPK server. | 45 // the WebAPK server. |
| 46 const int kWebApkDownloadUrlTimeoutMs = 60000; | 46 const int kWebApkDownloadUrlTimeoutMs = 60000; |
| 47 | 47 |
| 48 // The default number of milliseconds to wait for the WebAPK download to | 48 // The default number of milliseconds to wait for the WebAPK download to |
| 49 // complete. | 49 // complete. |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 | 515 |
| 516 void WebApkInstaller::OnSuccess() { | 516 void WebApkInstaller::OnSuccess() { |
| 517 finish_callback_.Run(true, webapk_package_); | 517 finish_callback_.Run(true, webapk_package_); |
| 518 delete this; | 518 delete this; |
| 519 } | 519 } |
| 520 | 520 |
| 521 void WebApkInstaller::OnFailure() { | 521 void WebApkInstaller::OnFailure() { |
| 522 finish_callback_.Run(false, webapk_package_); | 522 finish_callback_.Run(false, webapk_package_); |
| 523 delete this; | 523 delete this; |
| 524 } | 524 } |
| OLD | NEW |