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

Unified Diff: chrome/browser/android/ntp/ntp_snippets_bridge.cc

Issue 2574073003: [NTPSnippets] Records the time since last successful bg fetch. (Closed)
Patch Set: Rebase & address last comment treib Created 4 years 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 | components/ntp_snippets/content_suggestions_metrics.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/ntp/ntp_snippets_bridge.cc
diff --git a/chrome/browser/android/ntp/ntp_snippets_bridge.cc b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
index 1674d00ad9ba3b2e66c6bf13b4463ead1ec16829..21a18a5ec7476a95a6cad35e234e284093bec1ed 100644
--- a/chrome/browser/android/ntp/ntp_snippets_bridge.cc
+++ b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
@@ -22,7 +22,9 @@
#include "components/history/core/browser/history_service.h"
#include "components/ntp_snippets/content_suggestion.h"
#include "components/ntp_snippets/content_suggestions_metrics.h"
+#include "components/ntp_snippets/pref_names.h"
#include "components/ntp_snippets/remote/remote_suggestions_provider.h"
+#include "components/prefs/pref_service.h"
#include "jni/SnippetsBridge_jni.h"
#include "ui/base/window_open_disposition.h"
#include "ui/gfx/android/java_bitmap.h"
@@ -350,9 +352,15 @@ void NTPSnippetsBridge::OnSuggestionShown(JNIEnv* env,
jint category_position,
jlong publish_timestamp_ms,
jfloat score) {
+ PrefService* pref_service = ProfileManager::GetLastUsedProfile()->GetPrefs();
+ base::Time last_background_fetch_time =
+ base::Time::FromInternalValue(pref_service->GetInt64(
+ ntp_snippets::prefs::kLastSuccessfulBackgroundFetchTime));
+
ntp_snippets::metrics::OnSuggestionShown(
global_position, CategoryFromIDValue(j_category_id), category_position,
- base::Time::FromJavaTime(publish_timestamp_ms), score);
+ base::Time::FromJavaTime(publish_timestamp_ms),
+ last_background_fetch_time, score);
if (global_position == 0) {
content_suggestions_service_->user_classifier()->OnEvent(
ntp_snippets::UserClassifier::Metric::SUGGESTIONS_SHOWN);
« no previous file with comments | « no previous file | components/ntp_snippets/content_suggestions_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698