Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Unified Diff: chrome/browser/android/webapk/webapk_install_service.h

Issue 2733543002: [Android:WebAPK] Don't add webapp to homescreen if WebAPK install times out part 1/3 (Closed)
Patch Set: Merge branch 'start' into refactor_shortcut_helper3 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/webapk/webapk_install_service.h
diff --git a/chrome/browser/android/webapk/webapk_install_service.h b/chrome/browser/android/webapk/webapk_install_service.h
index 0a4e9d9d967b28d2e751ecaac23824e949bf92d4..1315b0aa9513325d78f45d06e7ebc4f2b271dbb1 100644
--- a/chrome/browser/android/webapk/webapk_install_service.h
+++ b/chrome/browser/android/webapk/webapk_install_service.h
@@ -12,7 +12,6 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "chrome/browser/android/webapk/webapk_installer.h"
#include "components/keyed_service/core/keyed_service.h"
#include "url/gurl.h"
@@ -23,11 +22,29 @@ class BrowserContext;
struct ShortcutInfo;
class SkBitmap;
+// A Java counterpart will be generated for this enum.
+// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.webapps
+enum class WebApkInstallResult {
+ SUCCESS = 0,
+ FAILURE = 1,
+ // An install was initiated but it timed out. We did not get a response from
+ // Google Play (or the Android OS in the case of the "unknown sources" flow)
+ // so it is possible that the install will complete some time in the future.
+ PROBABLE_FAILURE = 2
+};
+
// Service which talks to Chrome WebAPK server and Google Play to generate a
// WebAPK on the server, download it, and install it.
class WebApkInstallService : public KeyedService {
public:
- using FinishCallback = WebApkInstaller::FinishCallback;
+ // Called when the creation/updating of a WebAPK is finished or failed.
+ // Parameters:
+ // - the result of the installation.
+ // - true if Chrome received a "request updates less frequently" directive.
+ // from the WebAPK server.
+ // - the package name of the WebAPK.
+ using FinishCallback =
+ base::Callback<void(WebApkInstallResult, bool, const std::string&)>;
static WebApkInstallService* Get(content::BrowserContext* browser_context);
@@ -60,7 +77,7 @@ class WebApkInstallService : public KeyedService {
// Called once the install/update completed or failed.
void OnFinishedInstall(const GURL& web_manifest_url,
const FinishCallback& finish_callback,
- bool success,
+ WebApkInstallResult result,
bool relax_updates,
const std::string& webapk_package_name);

Powered by Google App Engine
This is Rietveld 408576698