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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // Sends request to WebAPK server to create WebAPK. During a successful | 76 // Sends request to WebAPK server to create WebAPK. During a successful |
77 // request the WebAPK server responds with the URL of the generated WebAPK. | 77 // request the WebAPK server responds with the URL of the generated WebAPK. |
78 // |webapk| is the proto to send to the WebAPK server. | 78 // |webapk| is the proto to send to the WebAPK server. |
79 void SendCreateWebApkRequest(std::unique_ptr<webapk::WebApk> webapk_proto); | 79 void SendCreateWebApkRequest(std::unique_ptr<webapk::WebApk> webapk_proto); |
80 | 80 |
81 // Called with the URL of generated WebAPK and the package name that the | 81 // Called with the URL of generated WebAPK and the package name that the |
82 // WebAPK should be installed at. | 82 // WebAPK should be installed at. |
83 void OnGotWebApkDownloadUrl(const GURL& download_url, | 83 void OnGotWebApkDownloadUrl(const GURL& download_url, |
84 const std::string& package_name); | 84 const std::string& package_name); |
85 | 85 |
86 // Called once the WebAPK has been downloaded. Installs the WebAPK if the | 86 // Called once the WebAPK has been downloaded. Makes the downloaded WebAPK |
87 // download was successful. | 87 // world readable and installs the WebAPK if the download was successful. |
88 // |file_path| is the file path that the WebAPK was downloaded to. | 88 // |file_path| is the file path that the WebAPK was downloaded to. |
89 // |package_name| is the package name that the WebAPK should be installed at. | 89 // |package_name| is the package name that the WebAPK should be installed at. |
90 void OnWebApkDownloaded(const base::FilePath& file_path, | 90 void OnWebApkDownloaded(const base::FilePath& file_path, |
91 const std::string& package_name, | 91 const std::string& package_name, |
92 FileDownloader::Result result); | 92 FileDownloader::Result result); |
93 | 93 |
| 94 // Called once the downloaded WebAPK has been made world readable. Installs |
| 95 // the WebAPK. |
| 96 // |file_path| is the file path that the WebAPK was downloaded to. |
| 97 // |package_name| is the package name that the WebAPK should be installed at. |
| 98 // |change_permission_success| is whether the WebAPK could be made world |
| 99 // readable. |
| 100 void OnWebApkMadeWorldReadable(const base::FilePath& file_path, |
| 101 const std::string& package_name, |
| 102 bool change_permission_success); |
| 103 |
94 // Populates webapk::WebApk and returns it. | 104 // Populates webapk::WebApk and returns it. |
95 // Must be called on a worker thread because it encodes an SkBitmap. | 105 // Must be called on a worker thread because it encodes an SkBitmap. |
96 std::unique_ptr<webapk::WebApk> BuildWebApkProtoInBackground(); | 106 std::unique_ptr<webapk::WebApk> BuildWebApkProtoInBackground(); |
97 | 107 |
98 // Called when the request to the WebAPK server times out or when the WebAPK | 108 // Called when the request to the WebAPK server times out or when the WebAPK |
99 // download times out. | 109 // download times out. |
100 void OnTimeout(); | 110 void OnTimeout(); |
101 | 111 |
102 // Called when the request to install the WebAPK is sent to Google Play. | 112 // Called when the request to install the WebAPK is sent to Google Play. |
103 void OnSuccess(); | 113 void OnSuccess(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // The number of milliseconds to wait for the WebAPK download to complete. | 149 // The number of milliseconds to wait for the WebAPK download to complete. |
140 int download_timeout_ms_; | 150 int download_timeout_ms_; |
141 | 151 |
142 // Used to get |weak_ptr_|. | 152 // Used to get |weak_ptr_|. |
143 base::WeakPtrFactory<WebApkInstaller> weak_ptr_factory_; | 153 base::WeakPtrFactory<WebApkInstaller> weak_ptr_factory_; |
144 | 154 |
145 DISALLOW_COPY_AND_ASSIGN(WebApkInstaller); | 155 DISALLOW_COPY_AND_ASSIGN(WebApkInstaller); |
146 }; | 156 }; |
147 | 157 |
148 #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ | 158 #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ |
OLD | NEW |