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 ddf1b785a3f70c36286e8b8295267aa82aa820a7..880792c88978d2369a1d88f914e677455075bd24 100644 |
--- a/chrome/browser/android/ntp/ntp_snippets_bridge.cc |
+++ b/chrome/browser/android/ntp/ntp_snippets_bridge.cc |
@@ -148,15 +148,6 @@ static void RemoteSuggestionsSchedulerRescheduleFetching( |
scheduler->RescheduleFetching(); |
} |
-static void OnSuggestionTargetVisited(JNIEnv* env, |
- const JavaParamRef<jclass>& caller, |
- jint j_category_id, |
- jlong visit_time_ms) { |
- ntp_snippets::metrics::OnSuggestionTargetVisited( |
- Category::FromIDValue(j_category_id), |
- base::TimeDelta::FromMilliseconds(visit_time_ms)); |
-} |
- |
static void SetRemoteSuggestionsEnabled(JNIEnv* env, |
const JavaParamRef<jclass>& caller, |
jboolean enabled) { |
@@ -391,135 +382,6 @@ void NTPSnippetsBridge::RestoreDismissedCategories( |
content_suggestions_service_->RestoreDismissedCategories(); |
} |
-void NTPSnippetsBridge::OnPageShown( |
- JNIEnv* env, |
- const JavaParamRef<jobject>& obj, |
- const JavaParamRef<jintArray>& jcategories, |
- const JavaParamRef<jintArray>& jsuggestions_per_category) { |
- std::vector<int> categories_int; |
- JavaIntArrayToIntVector(env, jcategories, &categories_int); |
- std::vector<int> suggestions_per_category_int; |
- JavaIntArrayToIntVector(env, jsuggestions_per_category, |
- &suggestions_per_category_int); |
- DCHECK_EQ(categories_int.size(), suggestions_per_category_int.size()); |
- std::vector<std::pair<Category, int>> suggestions_per_category; |
- for (size_t i = 0; i < categories_int.size(); i++) { |
- suggestions_per_category.push_back( |
- std::make_pair(Category::FromIDValue(categories_int[i]), |
- suggestions_per_category_int[i])); |
- } |
- ntp_snippets::metrics::OnPageShown(suggestions_per_category); |
- content_suggestions_service_->user_classifier()->OnEvent( |
- ntp_snippets::UserClassifier::Metric::NTP_OPENED); |
-} |
- |
-void NTPSnippetsBridge::OnSuggestionShown(JNIEnv* env, |
- const JavaParamRef<jobject>& obj, |
- jint global_position, |
- jint j_category_id, |
- jint position_in_category, |
- jlong publish_timestamp_ms, |
- 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), |
- score, base::Time::FromJavaTime(fetch_timestamp_ms)); |
- if (global_position == 0) { |
- content_suggestions_service_->user_classifier()->OnEvent( |
- ntp_snippets::UserClassifier::Metric::SUGGESTIONS_SHOWN); |
- } |
-} |
- |
-void NTPSnippetsBridge::OnSuggestionOpened(JNIEnv* env, |
- const JavaParamRef<jobject>& obj, |
- jint global_position, |
- jint j_category_id, |
- jint category_index, |
- jint position_in_category, |
- jlong publish_timestamp_ms, |
- jfloat score, |
- int windowOpenDisposition) { |
- const Category category = Category::FromIDValue(j_category_id); |
- ntp_snippets::metrics::OnSuggestionOpened( |
- global_position, category, category_index, position_in_category, |
- base::Time::FromJavaTime(publish_timestamp_ms), score, |
- static_cast<WindowOpenDisposition>(windowOpenDisposition)); |
- // TODO(vitaliii): Add ContentSuggestionsService::OnSuggestionOpened and |
- // notify the ranker and the classifier there instead. Do not expose both of |
- // them at all. See crbug.com/674080. |
- content_suggestions_service_->category_ranker()->OnSuggestionOpened(category); |
- content_suggestions_service_->user_classifier()->OnEvent( |
- ntp_snippets::UserClassifier::Metric::SUGGESTIONS_USED); |
-} |
- |
-void NTPSnippetsBridge::OnSuggestionMenuOpened(JNIEnv* env, |
- const JavaParamRef<jobject>& obj, |
- jint global_position, |
- jint j_category_id, |
- jint position_in_category, |
- jlong publish_timestamp_ms, |
- jfloat score) { |
- ntp_snippets::metrics::OnSuggestionMenuOpened( |
- global_position, Category::FromIDValue(j_category_id), |
- position_in_category, base::Time::FromJavaTime(publish_timestamp_ms), |
- score); |
-} |
- |
-void NTPSnippetsBridge::OnMoreButtonShown(JNIEnv* env, |
- const JavaParamRef<jobject>& obj, |
- jint j_category_id, |
- jint position) { |
- ntp_snippets::metrics::OnMoreButtonShown(Category::FromIDValue(j_category_id), |
- position); |
-} |
- |
-void NTPSnippetsBridge::OnMoreButtonClicked(JNIEnv* env, |
- const JavaParamRef<jobject>& obj, |
- jint j_category_id, |
- jint position) { |
- ntp_snippets::metrics::OnMoreButtonClicked( |
- Category::FromIDValue(j_category_id), position); |
- content_suggestions_service_->user_classifier()->OnEvent( |
- ntp_snippets::UserClassifier::Metric::SUGGESTIONS_USED); |
-} |
- |
-void NTPSnippetsBridge::OnNTPInitialized(JNIEnv* env, |
- const JavaParamRef<jobject>& obj) { |
- ntp_snippets::RemoteSuggestionsScheduler* scheduler = |
- GetRemoteSuggestionsScheduler(); |
- // Can be null if the feature has been disabled but the scheduler has not been |
- // unregistered yet. The next start should unregister it. |
- if (!scheduler) { |
- return; |
- } |
- |
- scheduler->OnNTPOpened(); |
-} |
- |
-void NTPSnippetsBridge::OnColdStart(JNIEnv* env, |
- const JavaParamRef<jobject>& obj) { |
- ntp_snippets::RemoteSuggestionsScheduler* scheduler = |
- GetRemoteSuggestionsScheduler(); |
- // TODO(fhorschig): Remove guard when https://crbug.com/678556 is resolved. |
- if (!scheduler) { |
- return; |
- } |
- scheduler->OnBrowserColdStart(); |
-} |
- |
-void NTPSnippetsBridge::OnActivityWarmResumed( |
- JNIEnv* env, |
- const JavaParamRef<jobject>& obj) { |
- ntp_snippets::RemoteSuggestionsScheduler* scheduler = |
- GetRemoteSuggestionsScheduler(); |
- // TODO(fhorschig): Remove guard when https://crbug.com/678556 is resolved. |
- if (!scheduler) { |
- return; |
- } |
- scheduler->OnBrowserForegrounded(); |
-} |
- |
NTPSnippetsBridge::~NTPSnippetsBridge() {} |
void NTPSnippetsBridge::OnNewSuggestions(Category category) { |