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

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

Issue 2844383004: Split the NOT_STARTED and STOPPED_BEFORE_COMPLETION installability metrics. (Closed)
Patch Set: Fix comment Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/installable/installable_manager_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/installable/installable_manager.cc
diff --git a/chrome/browser/installable/installable_manager.cc b/chrome/browser/installable/installable_manager.cc
index 0fbb0af1b3955adb5410f4df723048a27fe11fa9..a6d16ed16d76b633f176f256d50c4660ef6107cb 100644
--- a/chrome/browser/installable/installable_manager.cc
+++ b/chrome/browser/installable/installable_manager.cc
@@ -145,6 +145,8 @@ void InstallableManager::GetData(const InstallableParams& params,
return;
is_active_ = true;
+ if (page_status_ == InstallabilityCheckStatus::NOT_STARTED)
+ page_status_ = InstallabilityCheckStatus::NOT_COMPLETED;
StartNextTask();
}
@@ -165,11 +167,17 @@ void InstallableManager::RecordMenuItemAddToHomescreenHistogram() {
void InstallableManager::RecordQueuedMetricsOnTaskCompletion(
const InstallableParams& params,
bool check_passed) {
- // Don't do anything if we've already finished the PWA check or if this check
- // was not for the full PWA params. Once a full check is completed, metrics
- // will be directly recorded in Record*Histogram since
- // |is_pwa_check_complete_| will be true.
- if (is_pwa_check_complete_ || !IsParamsForPwaCheck(params))
+ // Don't do anything if we've:
+ // - already finished the PWA check, or
+ // - we passed the check AND it was not for the full PWA params.
+ // In the latter case (i.e. the check passed but we weren't checking
+ // everything), we don't yet know if the site is installable. However, if the
+ // check didn't pass, we know for sure the site isn't installable, regardless
+ // of how much we checked.
+ //
+ // Once a full check is completed, metrics will be directly recorded in
+ // Record*Histogram since |is_pwa_check_complete_| will be true.
+ if (is_pwa_check_complete_ || (check_passed && !IsParamsForPwaCheck(params)))
return;
is_pwa_check_complete_ = true;
@@ -295,22 +303,20 @@ void InstallableManager::Reset() {
icons_.clear();
// We may have reset prior to completion, in which case |menu_open_count_| or
- // |menu_item_add_to_homescreen_count_| will be nonzero. If we completed, then
- // these values cannot be anything except 0.
- page_status_ = InstallabilityCheckStatus::NOT_STARTED;
+ // |menu_item_add_to_homescreen_count_| might be nonzero and |page_status_| is
+ // one of NOT_STARTED or NOT_COMPLETED. If we completed, then these values
+ // cannot be anything except 0.
is_pwa_check_complete_ = false;
- for (; menu_open_count_ > 0; --menu_open_count_) {
- InstallableMetrics::RecordMenuOpenHistogram(
- InstallabilityCheckStatus::STOPPED_BEFORE_COMPLETION);
- }
+ for (; menu_open_count_ > 0; --menu_open_count_)
+ InstallableMetrics::RecordMenuOpenHistogram(page_status_);
for (; menu_item_add_to_homescreen_count_ > 0;
--menu_item_add_to_homescreen_count_) {
- InstallableMetrics::RecordMenuItemAddToHomescreenHistogram(
- InstallabilityCheckStatus::STOPPED_BEFORE_COMPLETION);
+ InstallableMetrics::RecordMenuItemAddToHomescreenHistogram(page_status_);
}
+ page_status_ = InstallabilityCheckStatus::NOT_STARTED;
manifest_.reset(new ManifestProperty());
installable_.reset(new InstallableProperty());
« no previous file with comments | « no previous file | chrome/browser/installable/installable_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698