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 |download_url|. |
| 153 void DownloadWebApk(const base::FilePath& output_path, |
| 154 const GURL& download_url, |
| 155 bool retry_if_fails); |
| 156 |
152 // Called once the sub directory to store the downloaded WebAPK was | 157 // Called once the sub directory to store the downloaded WebAPK was |
153 // created with permissions set properly or if creation failed. | 158 // created with permissions set properly or if creation failed. |
154 void OnCreatedSubDirAndSetPermissions(const GURL& download_url, | 159 void OnCreatedSubDirAndSetPermissions(const GURL& download_url, |
155 const base::FilePath& file_path); | 160 const base::FilePath& file_path); |
156 | 161 |
157 // Called once the WebAPK has been downloaded. Makes the downloaded WebAPK | 162 // Called once the WebAPK has been downloaded. Makes the downloaded WebAPK |
158 // world readable and installs the WebAPK if the download was successful. | 163 // world readable and installs the WebAPK if the download was successful. |
159 // |file_path| is the file path that the WebAPK was downloaded to. | 164 // |file_path| is the file path that the WebAPK was downloaded to. |
| 165 // If |retry_if_fails| is true, will post a delayed task and retry the |
| 166 // download after 2 seconds. |
160 void OnWebApkDownloaded(const base::FilePath& file_path, | 167 void OnWebApkDownloaded(const base::FilePath& file_path, |
| 168 const GURL& download_url, |
| 169 bool retry_if_fails, |
161 FileDownloader::Result result); | 170 FileDownloader::Result result); |
162 | 171 |
163 // Called once the downloaded WebAPK has been made world readable. Installs | 172 // Called once the downloaded WebAPK has been made world readable. Installs |
164 // the WebAPK. | 173 // the WebAPK. |
165 // |file_path| is the file path that the WebAPK was downloaded to. | 174 // |file_path| is the file path that the WebAPK was downloaded to. |
166 // |change_permission_success| is whether the WebAPK could be made world | 175 // |change_permission_success| is whether the WebAPK could be made world |
167 // readable. | 176 // readable. |
168 void OnWebApkMadeWorldReadable(const base::FilePath& file_path, | 177 void OnWebApkMadeWorldReadable(const base::FilePath& file_path, |
169 bool change_permission_success); | 178 bool change_permission_success); |
170 | 179 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // Points to the Java Object. | 237 // Points to the Java Object. |
229 base::android::ScopedJavaGlobalRef<jobject> java_ref_; | 238 base::android::ScopedJavaGlobalRef<jobject> java_ref_; |
230 | 239 |
231 // Used to get |weak_ptr_|. | 240 // Used to get |weak_ptr_|. |
232 base::WeakPtrFactory<WebApkInstaller> weak_ptr_factory_; | 241 base::WeakPtrFactory<WebApkInstaller> weak_ptr_factory_; |
233 | 242 |
234 DISALLOW_COPY_AND_ASSIGN(WebApkInstaller); | 243 DISALLOW_COPY_AND_ASSIGN(WebApkInstaller); |
235 }; | 244 }; |
236 | 245 |
237 #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ | 246 #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ |
OLD | NEW |