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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 void NTPSnippetsBridge::OnMoreButtonClicked(JNIEnv* env, | 389 void NTPSnippetsBridge::OnMoreButtonClicked(JNIEnv* env, |
390 const JavaParamRef<jobject>& obj, | 390 const JavaParamRef<jobject>& obj, |
391 jint j_category_id, | 391 jint j_category_id, |
392 jint position) { | 392 jint position) { |
393 ntp_snippets::metrics::OnMoreButtonClicked( | 393 ntp_snippets::metrics::OnMoreButtonClicked( |
394 Category::FromIDValue(j_category_id), position); | 394 Category::FromIDValue(j_category_id), position); |
395 content_suggestions_service_->user_classifier()->OnEvent( | 395 content_suggestions_service_->user_classifier()->OnEvent( |
396 ntp_snippets::UserClassifier::Metric::SUGGESTIONS_USED); | 396 ntp_snippets::UserClassifier::Metric::SUGGESTIONS_USED); |
397 } | 397 } |
398 | 398 |
| 399 void NTPSnippetsBridge::OnActivityResumed( |
| 400 JNIEnv* env, |
| 401 const base::android::JavaParamRef<jobject>& obj) { |
| 402 content_suggestions_service_->remote_suggestions_scheduler() |
| 403 ->OnBrowserResumed(); |
| 404 } |
| 405 |
399 NTPSnippetsBridge::~NTPSnippetsBridge() {} | 406 NTPSnippetsBridge::~NTPSnippetsBridge() {} |
400 | 407 |
401 void NTPSnippetsBridge::OnNewSuggestions(Category category) { | 408 void NTPSnippetsBridge::OnNewSuggestions(Category category) { |
402 if (observer_.is_null()) { | 409 if (observer_.is_null()) { |
403 return; | 410 return; |
404 } | 411 } |
405 | 412 |
406 JNIEnv* env = base::android::AttachCurrentThread(); | 413 JNIEnv* env = base::android::AttachCurrentThread(); |
407 Java_SnippetsBridge_onNewSuggestions(env, observer_, | 414 Java_SnippetsBridge_onNewSuggestions(env, observer_, |
408 static_cast<int>(category.id())); | 415 static_cast<int>(category.id())); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 JNIEnv* env = AttachCurrentThread(); | 470 JNIEnv* env = AttachCurrentThread(); |
464 Java_SnippetsBridge_onMoreSuggestions( | 471 Java_SnippetsBridge_onMoreSuggestions( |
465 env, observer_, category.id(), | 472 env, observer_, category.id(), |
466 ToJavaSuggestionList(env, category, suggestions)); | 473 ToJavaSuggestionList(env, category, suggestions)); |
467 } | 474 } |
468 | 475 |
469 // static | 476 // static |
470 bool NTPSnippetsBridge::Register(JNIEnv* env) { | 477 bool NTPSnippetsBridge::Register(JNIEnv* env) { |
471 return RegisterNativesImpl(env); | 478 return RegisterNativesImpl(env); |
472 } | 479 } |
OLD | NEW |