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

Unified Diff: components/doodle/doodle_service.cc

Issue 2833473002: Record NTP.LogoShownTime for timely refreshs only (Closed)
Patch Set: Fix compile error Created 3 years, 8 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 | « components/doodle/doodle_service.h ('k') | components/doodle/doodle_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/doodle/doodle_service.cc
diff --git a/components/doodle/doodle_service.cc b/components/doodle/doodle_service.cc
index cd4b053edf1c7083b14f13e6c7f8db6e290bd971..1b8d27a00b65d54464700d7104f0484f4dbceb9f 100644
--- a/components/doodle/doodle_service.cc
+++ b/components/doodle/doodle_service.cc
@@ -87,6 +87,9 @@ void DoodleService::Refresh() {
if (time_since_fetch < min_refresh_interval_) {
RecordDownloadMetrics(OUTCOME_REFRESH_INTERVAL_NOT_PASSED,
base::TimeDelta());
+ for (auto& observer : observers_) {
+ observer.OnDoodleConfigRevalidated(/*from_cache=*/true);
+ }
return;
}
fetcher_->FetchDoodle(base::BindOnce(&DoodleService::DoodleFetched,
@@ -192,7 +195,6 @@ DoodleService::DownloadOutcome DoodleService::HandleNewConfig(
DownloadOutcome outcome =
DetermineDownloadOutcome(cached_config_, new_config, state, expired);
- // If the config changed, update our cache and notify observers.
// Note that this checks both for existence changes as well as changes of the
// configs themselves.
if (cached_config_ != new_config) {
@@ -201,6 +203,10 @@ DoodleService::DownloadOutcome DoodleService::HandleNewConfig(
for (auto& observer : observers_) {
observer.OnDoodleConfigUpdated(cached_config_);
}
+ } else {
+ for (auto& observer : observers_) {
+ observer.OnDoodleConfigRevalidated(/*from_cache=*/false);
+ }
}
// Even if the configs are identical, the time-to-live might have changed.
« no previous file with comments | « components/doodle/doodle_service.h ('k') | components/doodle/doodle_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698