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

Unified Diff: chrome/browser/banners/app_banner_manager.h

Issue 2957063002: Update app banner state machine to use more states. (Closed)
Patch Set: Remove is_active_or_pending Created 3 years, 6 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/banners/app_banner_manager.h
diff --git a/chrome/browser/banners/app_banner_manager.h b/chrome/browser/banners/app_banner_manager.h
index 9bd558d294a8e14484eb50d4400cd036a241d4d9..41ba2ae1cdac9fb8978e6b18234b8161a4acae64 100644
--- a/chrome/browser/banners/app_banner_manager.h
+++ b/chrome/browser/banners/app_banner_manager.h
@@ -103,19 +103,28 @@ class AppBannerManager : public content::WebContentsObserver,
// The banner pipeline is currently waiting for the page manifest to be
// fetched.
- PENDING_MANIFEST,
+ FETCHING_MANIFEST,
// The banner pipeline is currently waiting for the installability criteria
- // to be checked.
+ // to be checked. This could be paused while waiting for the site to
+ // register a service worker.
PENDING_INSTALLABLE_CHECK,
// The banner pipeline has finished running, but is waiting for sufficient
// engagement to trigger the banner.
PENDING_ENGAGEMENT,
- // The banner pipeline has finished running, but is waiting for an event to
- // trigger the banner.
- PENDING_EVENT,
+ // The banner has sent the beforeinstallprompt event and is waiting for the
+ // resposne to the event.
+ SENDING_EVENT,
+
+ // The banner has sent the beforeinstallprompt, and the web page called
+ // prompt on the event while the event was being handled.
+ SENDING_EVENT_GOT_EARLY_PROMPT,
+
+ // The banner pipeline has finished running, but is waiting for the web page
+ // to call prompt on the event.
+ PENDING_PROMPT,
// The banner pipeline has finished running for this page load and no more
// processing is to be done.
@@ -218,28 +227,12 @@ class AppBannerManager : public content::WebContentsObserver,
// this class.
InstallableManager* manager() const { return manager_; }
int event_request_id() const { return event_request_id_; }
+ bool is_inactive() const { return state_ == State::INACTIVE; }
bool is_active() const { return state_ == State::ACTIVE; }
- bool is_active_or_pending() const {
- switch (state_) {
- case State::ACTIVE:
- case State::PENDING_MANIFEST:
- case State::PENDING_INSTALLABLE_CHECK:
- case State::PENDING_ENGAGEMENT:
- case State::PENDING_EVENT:
- return true;
- case State::INACTIVE:
- case State::COMPLETE:
- return false;
- }
- return false;
- }
bool is_complete() const { return state_ == State::COMPLETE; }
bool is_pending_engagement() const {
return state_ == State::PENDING_ENGAGEMENT;
}
- bool is_pending_event() const {
- return state_ == State::PENDING_EVENT || page_requested_prompt_;
- }
// The title to display in the banner.
base::string16 app_title_;
@@ -310,9 +303,6 @@ class AppBannerManager : public content::WebContentsObserver,
bool has_sufficient_engagement_;
bool load_finished_;
- // Record whether the page requests for a banner to be shown later on.
- bool page_requested_prompt_;
-
// Whether the current flow was begun via devtools.
bool triggered_by_devtools_;
« no previous file with comments | « no previous file | chrome/browser/banners/app_banner_manager.cc » ('j') | chrome/browser/banners/app_banner_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698