| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/android/ntp/ntp_snippets_bridge.h" | 5 #include "chrome/browser/android/ntp/ntp_snippets_bridge.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 if (global_position == 0) { | 340 if (global_position == 0) { |
| 341 content_suggestions_service_->user_classifier()->OnEvent( | 341 content_suggestions_service_->user_classifier()->OnEvent( |
| 342 ntp_snippets::UserClassifier::Metric::SUGGESTIONS_SHOWN); | 342 ntp_snippets::UserClassifier::Metric::SUGGESTIONS_SHOWN); |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 | 345 |
| 346 void NTPSnippetsBridge::OnSuggestionOpened(JNIEnv* env, | 346 void NTPSnippetsBridge::OnSuggestionOpened(JNIEnv* env, |
| 347 const JavaParamRef<jobject>& obj, | 347 const JavaParamRef<jobject>& obj, |
| 348 jint global_position, | 348 jint global_position, |
| 349 jint j_category_id, | 349 jint j_category_id, |
| 350 jint category_index, |
| 350 jint category_position, | 351 jint category_position, |
| 351 jlong publish_timestamp_ms, | 352 jlong publish_timestamp_ms, |
| 352 jfloat score, | 353 jfloat score, |
| 353 int windowOpenDisposition) { | 354 int windowOpenDisposition) { |
| 354 ntp_snippets::metrics::OnSuggestionOpened( | 355 ntp_snippets::metrics::OnSuggestionOpened( |
| 355 global_position, Category::FromIDValue(j_category_id), category_position, | 356 global_position, Category::FromIDValue(j_category_id), category_position, |
| 356 base::Time::FromJavaTime(publish_timestamp_ms), score, | 357 base::Time::FromJavaTime(publish_timestamp_ms), score, |
| 357 static_cast<WindowOpenDisposition>(windowOpenDisposition)); | 358 static_cast<WindowOpenDisposition>(windowOpenDisposition)); |
| 358 // TODO(vitaliii): Add ContentSuggestionsService::OnSuggestionOpened and | 359 // TODO(vitaliii): Add ContentSuggestionsService::OnSuggestionOpened and |
| 359 // notify the ranker and the classifier there instead. Do not expose both of | 360 // notify the ranker and the classifier there instead. Do not expose both of |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 JNIEnv* env = AttachCurrentThread(); | 484 JNIEnv* env = AttachCurrentThread(); |
| 484 Java_SnippetsBridge_onMoreSuggestions( | 485 Java_SnippetsBridge_onMoreSuggestions( |
| 485 env, bridge_, category.id(), | 486 env, bridge_, category.id(), |
| 486 ToJavaSuggestionList(env, category, suggestions)); | 487 ToJavaSuggestionList(env, category, suggestions)); |
| 487 } | 488 } |
| 488 | 489 |
| 489 // static | 490 // static |
| 490 bool NTPSnippetsBridge::Register(JNIEnv* env) { | 491 bool NTPSnippetsBridge::Register(JNIEnv* env) { |
| 491 return RegisterNativesImpl(env); | 492 return RegisterNativesImpl(env); |
| 492 } | 493 } |
| OLD | NEW |