Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ | 6 #define CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 // WebAPK. | 142 // WebAPK. |
| 143 void SendRequest(std::unique_ptr<webapk::WebApk> request_proto, | 143 void SendRequest(std::unique_ptr<webapk::WebApk> request_proto, |
| 144 net::URLFetcher::RequestType request_type, | 144 net::URLFetcher::RequestType request_type, |
| 145 const GURL& server_url); | 145 const GURL& server_url); |
| 146 | 146 |
| 147 // Called with the URL of generated WebAPK and the package name that the | 147 // Called with the URL of generated WebAPK and the package name that the |
| 148 // WebAPK should be installed at. | 148 // WebAPK should be installed at. |
| 149 void OnGotWebApkDownloadUrl(const GURL& download_url, | 149 void OnGotWebApkDownloadUrl(const GURL& download_url, |
| 150 const std::string& package_name); | 150 const std::string& package_name); |
| 151 | 151 |
| 152 // Downloads the WebAPK from the given |donwload_url|. | |
|
pkotwicz
2016/09/27 19:47:28
Nit: |donwload_url| -> |download_url|.
Xi Han
2016/09/27 20:53:31
Done.
| |
| 153 void StartDownloadingWebApk(const base::FilePath& output_path, | |
| 154 const GURL& download_url, | |
| 155 bool retry_if_fails); | |
| 156 | |
| 152 // Called once the WebAPK has been downloaded. Makes the downloaded WebAPK | 157 // Called once the WebAPK has been downloaded. Makes the downloaded WebAPK |
| 153 // world readable and installs the WebAPK if the download was successful. | 158 // world readable and installs the WebAPK if the download was successful. |
| 154 // |file_path| is the file path that the WebAPK was downloaded to. | 159 // |file_path| is the file path that the WebAPK was downloaded to. |
| 160 // If |retry_if_fails| is true, will sleep 2 seconds and retry the download. | |
|
pkotwicz
2016/09/27 19:47:28
You should post a delayed task instead of sleeping
Xi Han
2016/09/27 20:53:31
Done.
| |
| 155 void OnWebApkDownloaded(const base::FilePath& file_path, | 161 void OnWebApkDownloaded(const base::FilePath& file_path, |
| 162 const GURL& download_url, | |
| 163 bool retry_if_fails, | |
| 156 FileDownloader::Result result); | 164 FileDownloader::Result result); |
| 157 | 165 |
| 158 // Called once the downloaded WebAPK has been made world readable. Installs | 166 // Called once the downloaded WebAPK has been made world readable. Installs |
| 159 // the WebAPK. | 167 // the WebAPK. |
| 160 // |file_path| is the file path that the WebAPK was downloaded to. | 168 // |file_path| is the file path that the WebAPK was downloaded to. |
| 161 // |change_permission_success| is whether the WebAPK could be made world | 169 // |change_permission_success| is whether the WebAPK could be made world |
| 162 // readable. | 170 // readable. |
| 163 void OnWebApkMadeWorldReadable(const base::FilePath& file_path, | 171 void OnWebApkMadeWorldReadable(const base::FilePath& file_path, |
| 164 bool change_permission_success); | 172 bool change_permission_success); |
| 165 | 173 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 // Points to the Java Object. | 231 // Points to the Java Object. |
| 224 base::android::ScopedJavaGlobalRef<jobject> java_ref_; | 232 base::android::ScopedJavaGlobalRef<jobject> java_ref_; |
| 225 | 233 |
| 226 // Used to get |weak_ptr_|. | 234 // Used to get |weak_ptr_|. |
| 227 base::WeakPtrFactory<WebApkInstaller> weak_ptr_factory_; | 235 base::WeakPtrFactory<WebApkInstaller> weak_ptr_factory_; |
| 228 | 236 |
| 229 DISALLOW_COPY_AND_ASSIGN(WebApkInstaller); | 237 DISALLOW_COPY_AND_ASSIGN(WebApkInstaller); |
| 230 }; | 238 }; |
| 231 | 239 |
| 232 #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ | 240 #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ |
| OLD | NEW |