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

Unified Diff: chrome/browser/installable/installable_manager.h

Issue 2778983005: Allow the app banner installability check to run on page load. (Closed)
Patch Set: Fix enum in test + minor improvements 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/installable/installable_manager.h
diff --git a/chrome/browser/installable/installable_manager.h b/chrome/browser/installable/installable_manager.h
index 5d56abd0e35b2c22e0a9c43bcf3e4b70d394e9b1..f1cb288eb27d152309c7d712dbc8832ea97085c9 100644
--- a/chrome/browser/installable/installable_manager.h
+++ b/chrome/browser/installable/installable_manager.h
@@ -16,6 +16,7 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/installable/installable_logging.h"
+#include "chrome/browser/installable/installable_metrics.h"
#include "content/public/browser/service_worker_context.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
@@ -128,7 +129,16 @@ class InstallableManager
virtual void GetData(const InstallableParams& params,
const InstallableCallback& callback);
+ // Called via AppBannerManagerAndroid to record metrics on how often the
+ // installable check is completed when the menu or add to homescreen menu item
+ // is opened on Android.
+ void RecordMenuOpenHistogram();
+ void RecordMenuItemAddToHomescreenHistogram();
+ void RecordQueuedMetricsOnTaskCompletion(const InstallableParams& params,
+ bool check_passed);
+
private:
+ friend class InstallableManagerBrowserTest;
friend class InstallableManagerUnitTest;
FRIEND_TEST_ALL_PREFIXES(InstallableManagerBrowserTest,
ManagerBeginsInEmptyState);
@@ -218,7 +228,19 @@ class InstallableManager
std::unique_ptr<InstallableProperty> installable_;
std::map<IconParams, IconProperty> icons_;
+ // Whether or not the current page is a PWA. This is reset per navigation and
+ // is independent of the caching mechanism, i.e. if a PWA check is run
+ // multiple times for one page, this will be set on the first check.
+ InstallableMetrics::InstallabilityCheckStatus page_status_;
+
+ // Counts for the number of queued requests of the menu and add to homescreen
+ // menu item there have been whilst the installable check is awaiting
+ // completion. Used for metrics recording.
+ int menu_open_count_;
+ int menu_item_count_;
+
bool is_active_;
+ bool is_pwa_check_complete_;
base::WeakPtrFactory<InstallableManager> weak_factory_;

Powered by Google App Engine
This is Rietveld 408576698