| Index: chrome/browser/android/webapk/webapk_installer.h
|
| diff --git a/chrome/browser/android/webapk/webapk_installer.h b/chrome/browser/android/webapk/webapk_installer.h
|
| index 999751a1d7f87da62ead6246a23774086c3534dd..9a64e1931df0d467de2e11db63aca4b4c5522948 100644
|
| --- a/chrome/browser/android/webapk/webapk_installer.h
|
| +++ b/chrome/browser/android/webapk/webapk_installer.h
|
| @@ -21,10 +21,6 @@
|
| #include "net/url_request/url_fetcher_delegate.h"
|
| #include "third_party/skia/include/core/SkBitmap.h"
|
|
|
| -namespace base {
|
| -class FilePath;
|
| -}
|
| -
|
| namespace content {
|
| class BrowserContext;
|
| }
|
| @@ -35,9 +31,9 @@ class WebApk;
|
|
|
| class WebApkIconHasher;
|
|
|
| -// Talks to Chrome WebAPK server and Google Play to generate a WebAPK on the
|
| -// server, download it, and install it. The native WebApkInstaller owns the
|
| -// Java WebApkInstaller counterpart.
|
| +// Talks to Chrome WebAPK server to download metadata about WebApk and issue
|
| +// a request for it to be installed. The native WebApkInstaller owns the Java
|
| +// WebApkInstaller counterpart.
|
| class WebApkInstaller : public net::URLFetcherDelegate {
|
| public:
|
| using FinishCallback = WebApkInstallService::FinishCallback;
|
| @@ -45,18 +41,16 @@ class WebApkInstaller : public net::URLFetcherDelegate {
|
| ~WebApkInstaller() override;
|
|
|
| // Creates a self-owned WebApkInstaller instance and talks to the Chrome
|
| - // WebAPK server to generate a WebAPK on the server and to Google Play to
|
| - // install the downloaded WebAPK. Calls |callback| once the install completed
|
| - // or failed.
|
| + // WebAPK server to generate a WebAPK on the server and locally requests the
|
| + // APK to be installed. Calls |callback| once the install completed or failed.
|
| static void InstallAsync(content::BrowserContext* context,
|
| const ShortcutInfo& shortcut_info,
|
| const SkBitmap& shortcut_icon,
|
| const FinishCallback& finish_callback);
|
|
|
| // Creates a self-owned WebApkInstaller instance and talks to the Chrome
|
| - // WebAPK server to update a WebAPK on the server and to the Google Play
|
| - // server to install the downloaded WebAPK. Calls |callback| after the request
|
| - // to install the WebAPK is sent to the Google Play server.
|
| + // WebAPK server to update a WebAPK on the server and locally requests the
|
| + // APK to be installed. Calls |callback| once the install completed or failed.
|
| static void UpdateAsync(
|
| content::BrowserContext* context,
|
| const ShortcutInfo& shortcut_info,
|
| @@ -105,29 +99,14 @@ class WebApkInstaller : public net::URLFetcherDelegate {
|
| const ShortcutInfo& shortcut_info,
|
| const SkBitmap& shortcut_icon);
|
|
|
| - // Starts installion of the downloaded WebAPK.
|
| - // |file_path| is the file path that the WebAPK was downloaded to.
|
| - // |package_name| is the package name of the WebAPK.
|
| - virtual void InstallDownloadedWebApk(
|
| - JNIEnv* env,
|
| - const base::android::ScopedJavaLocalRef<jstring>& java_file_path,
|
| - const base::android::ScopedJavaLocalRef<jstring>& java_package_name);
|
| -
|
| - // Starts update using the downloaded WebAPK.
|
| - // |file_path| is the file path that the WebAPK was downloaded to.
|
| - virtual void UpdateUsingDownloadedWebApk(
|
| - JNIEnv* env,
|
| - const base::android::ScopedJavaLocalRef<jstring>& java_file_path);
|
| -
|
| - // Returns whether Google Play supports installing WebAPKs.
|
| - virtual bool CanUseGooglePlayInstallService();
|
| + // Returns whether the device supports installing WebAPKs.
|
| + virtual bool CanInstallWebApks();
|
|
|
| // Called when the package name of the WebAPK is available and the install
|
| - // or update request is handled by Google Play.
|
| - virtual void InstallOrUpdateWebApkFromGooglePlay(
|
| - const std::string& package_name,
|
| - int version,
|
| - const std::string& token);
|
| + // or update request should be issued.
|
| + virtual void InstallOrUpdateWebApk(const std::string& package_name,
|
| + int version,
|
| + const std::string& token);
|
|
|
| // Called when the install or update process has completed or failed.
|
| void OnResult(WebApkInstallResult result);
|
| @@ -174,7 +153,8 @@ class WebApkInstaller : public net::URLFetcherDelegate {
|
| // Sends request to WebAPK server to update a WebAPK. During a successful
|
| // request the WebAPK server responds with the URL of the generated WebAPK.
|
| // |webapk| is the proto to send to the WebAPK server.
|
| - void SendUpdateWebApkRequest(std::unique_ptr<webapk::WebApk> webapk_proto);
|
| + void SendUpdateWebApkRequest(int webapk_version,
|
| + std::unique_ptr<webapk::WebApk> webapk_proto);
|
|
|
| // Sends a request to WebAPK server to create/update WebAPK. During a
|
| // successful request the WebAPK server responds with the URL of the generated
|
| @@ -182,39 +162,6 @@ class WebApkInstaller : public net::URLFetcherDelegate {
|
| void SendRequest(std::unique_ptr<webapk::WebApk> request_proto,
|
| const GURL& server_url);
|
|
|
| - // Called with the URL of generated WebAPK and the package name that the
|
| - // WebAPK should be installed at.
|
| - void OnGotWebApkDownloadUrl(const GURL& download_url,
|
| - const std::string& package_name);
|
| -
|
| - // Downloads the WebAPK from the given |download_url|.
|
| - void DownloadWebApk(const base::FilePath& output_path,
|
| - const GURL& download_url,
|
| - bool retry_if_fails);
|
| -
|
| - // Called once the sub directory to store the downloaded WebAPK was
|
| - // created with permissions set properly or if creation failed.
|
| - void OnCreatedSubDirAndSetPermissions(const GURL& download_url,
|
| - const base::FilePath& file_path);
|
| -
|
| - // Called once the WebAPK has been downloaded. Makes the downloaded WebAPK
|
| - // world readable and installs the WebAPK if the download was successful.
|
| - // |file_path| is the file path that the WebAPK was downloaded to.
|
| - // If |retry_if_fails| is true, will post a delayed task and retry the
|
| - // download after 2 seconds.
|
| - void OnWebApkDownloaded(const base::FilePath& file_path,
|
| - const GURL& download_url,
|
| - bool retry_if_fails,
|
| - FileDownloader::Result result);
|
| -
|
| - // Called once the downloaded WebAPK has been made world readable. Installs
|
| - // the WebAPK.
|
| - // |file_path| is the file path that the WebAPK was downloaded to.
|
| - // |change_permission_success| is whether the WebAPK could be made world
|
| - // readable.
|
| - void OnWebApkMadeWorldReadable(const base::FilePath& file_path,
|
| - bool change_permission_success);
|
| -
|
| net::URLRequestContextGetter* request_context_getter_;
|
|
|
| // Sends HTTP request to WebAPK server.
|
| @@ -242,12 +189,8 @@ class WebApkInstaller : public net::URLFetcherDelegate {
|
| // WebAPK server URL.
|
| GURL server_url_;
|
|
|
| - // The number of milliseconds to wait for the WebAPK download URL from the
|
| - // WebAPK server.
|
| - int webapk_download_url_timeout_ms_;
|
| -
|
| - // The number of milliseconds to wait for the WebAPK download to complete.
|
| - int download_timeout_ms_;
|
| + // The number of milliseconds to wait for the WebAPK server to respond.
|
| + int webapk_server_timeout_ms_;
|
|
|
| // WebAPK package name.
|
| std::string webapk_package_;
|
| @@ -255,8 +198,6 @@ class WebApkInstaller : public net::URLFetcherDelegate {
|
| // Whether the server wants the WebAPK to request updates less frequently.
|
| bool relax_updates_;
|
|
|
| - // WebAPK version code.
|
| - int webapk_version_;
|
|
|
| // Indicates whether the installer is for installing or updating a WebAPK.
|
| TaskType task_type_;
|
|
|