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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::OnNTPInitialized( | 399 void NTPSnippetsBridge::OnNTPInitialized( |
400 JNIEnv* env, | 400 JNIEnv* env, |
401 const base::android::JavaParamRef<jobject>& obj) { | 401 const base::android::JavaParamRef<jobject>& obj) { |
402 content_suggestions_service_->remote_suggestions_scheduler()->OnNTPOpened(); | 402 content_suggestions_service_->remote_suggestions_scheduler()->OnNTPOpened(); |
403 } | 403 } |
404 | 404 |
| 405 void NTPSnippetsBridge::OnColdStart( |
| 406 JNIEnv* env, |
| 407 const base::android::JavaParamRef<jobject>& obj) { |
| 408 content_suggestions_service_->remote_suggestions_scheduler() |
| 409 ->OnBrowserColdStart(); |
| 410 } |
| 411 |
| 412 void NTPSnippetsBridge::OnWarmStartedActivityResumed( |
| 413 JNIEnv* env, |
| 414 const base::android::JavaParamRef<jobject>& obj) { |
| 415 content_suggestions_service_->remote_suggestions_scheduler() |
| 416 ->OnBrowserForegrounded(); |
| 417 } |
| 418 |
405 NTPSnippetsBridge::~NTPSnippetsBridge() {} | 419 NTPSnippetsBridge::~NTPSnippetsBridge() {} |
406 | 420 |
407 void NTPSnippetsBridge::OnNewSuggestions(Category category) { | 421 void NTPSnippetsBridge::OnNewSuggestions(Category category) { |
408 if (observer_.is_null()) { | 422 if (observer_.is_null()) { |
409 return; | 423 return; |
410 } | 424 } |
411 | 425 |
412 JNIEnv* env = base::android::AttachCurrentThread(); | 426 JNIEnv* env = base::android::AttachCurrentThread(); |
413 Java_SnippetsBridge_onNewSuggestions(env, observer_, | 427 Java_SnippetsBridge_onNewSuggestions(env, observer_, |
414 static_cast<int>(category.id())); | 428 static_cast<int>(category.id())); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 JNIEnv* env = AttachCurrentThread(); | 483 JNIEnv* env = AttachCurrentThread(); |
470 Java_SnippetsBridge_onMoreSuggestions( | 484 Java_SnippetsBridge_onMoreSuggestions( |
471 env, observer_, category.id(), | 485 env, observer_, category.id(), |
472 ToJavaSuggestionList(env, category, suggestions)); | 486 ToJavaSuggestionList(env, category, suggestions)); |
473 } | 487 } |
474 | 488 |
475 // static | 489 // static |
476 bool NTPSnippetsBridge::Register(JNIEnv* env) { | 490 bool NTPSnippetsBridge::Register(JNIEnv* env) { |
477 return RegisterNativesImpl(env); | 491 return RegisterNativesImpl(env); |
478 } | 492 } |
OLD | NEW |