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

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

Issue 2686063003: [remote suggestions] Attach the fetch time to RemoteSnippets, ContentSnippets and SnippetArticle (Closed)
Patch Set: rebase Created 3 years, 10 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/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 3389af1dd149f3c82f0e81cd561407da7f9bc748..b5d38e1962aae2b7c05a3f78e0eaa91ce0b3d886 100644
--- a/chrome/browser/android/ntp/ntp_snippets_bridge.cc
+++ b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
@@ -22,10 +22,8 @@
#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/ntp_snippets/remote/remote_suggestions_scheduler.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"
@@ -65,7 +63,8 @@ ScopedJavaLocalRef<jobject> ToJavaSuggestionList(
ConvertUTF16ToJavaString(env, suggestion.publisher_name()),
ConvertUTF16ToJavaString(env, suggestion.snippet_text()),
ConvertUTF8ToJavaString(env, suggestion.url().spec()),
- suggestion.publish_date().ToJavaTime(), suggestion.score());
+ suggestion.publish_date().ToJavaTime(), suggestion.score(),
+ suggestion.fetch_date().ToJavaTime());
if (suggestion.id().category().IsKnownCategory(
KnownCategories::DOWNLOADS) &&
suggestion.download_suggestion_extra() != nullptr) {
@@ -325,16 +324,12 @@ void NTPSnippetsBridge::OnSuggestionShown(JNIEnv* env,
jint j_category_id,
jint position_in_category,
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));
-
+ jfloat score,
+ jlong fetch_timestamp_ms) {
ntp_snippets::metrics::OnSuggestionShown(
global_position, Category::FromIDValue(j_category_id),
position_in_category, base::Time::FromJavaTime(publish_timestamp_ms),
- last_background_fetch_time, score);
+ score, base::Time::FromJavaTime(fetch_timestamp_ms));
if (global_position == 0) {
content_suggestions_service_->user_classifier()->OnEvent(
ntp_snippets::UserClassifier::Metric::SUGGESTIONS_SHOWN);

Powered by Google App Engine
This is Rietveld 408576698