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

Side by Side Diff: chrome/browser/android/ntp/ntp_snippets_bridge.cc

Issue 2592053004: Call the Scheduler when opening the NTP. (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
OLDNEW
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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 void NTPSnippetsBridge::OnMoreButtonClicked(JNIEnv* env, 406 void NTPSnippetsBridge::OnMoreButtonClicked(JNIEnv* env,
407 const JavaParamRef<jobject>& obj, 407 const JavaParamRef<jobject>& obj,
408 jint j_category_id, 408 jint j_category_id,
409 jint position) { 409 jint position) {
410 ntp_snippets::metrics::OnMoreButtonClicked( 410 ntp_snippets::metrics::OnMoreButtonClicked(
411 Category::FromIDValue(j_category_id), position); 411 Category::FromIDValue(j_category_id), position);
412 content_suggestions_service_->user_classifier()->OnEvent( 412 content_suggestions_service_->user_classifier()->OnEvent(
413 ntp_snippets::UserClassifier::Metric::SUGGESTIONS_USED); 413 ntp_snippets::UserClassifier::Metric::SUGGESTIONS_USED);
414 } 414 }
415 415
416 void NTPSnippetsBridge::OnNTPOpened(JNIEnv* env) {
417 content_suggestions_service_->remote_suggestions_scheduler()-> OnNTPOpened();
Michael van Ouwerkerk 2016/12/22 11:38:33 There seems to be a space in "-> OnNTPOpened"
fhorschig 2016/12/22 12:26:50 Done.
418 }
419
416 NTPSnippetsBridge::~NTPSnippetsBridge() {} 420 NTPSnippetsBridge::~NTPSnippetsBridge() {}
417 421
418 void NTPSnippetsBridge::OnNewSuggestions(Category category) { 422 void NTPSnippetsBridge::OnNewSuggestions(Category category) {
419 if (observer_.is_null()) { 423 if (observer_.is_null()) {
420 return; 424 return;
421 } 425 }
422 426
423 JNIEnv* env = base::android::AttachCurrentThread(); 427 JNIEnv* env = base::android::AttachCurrentThread();
424 Java_SnippetsBridge_onNewSuggestions(env, observer_, 428 Java_SnippetsBridge_onNewSuggestions(env, observer_,
425 static_cast<int>(category.id())); 429 static_cast<int>(category.id()));
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 JNIEnv* env = AttachCurrentThread(); 484 JNIEnv* env = AttachCurrentThread();
481 Java_SnippetsBridge_onMoreSuggestions( 485 Java_SnippetsBridge_onMoreSuggestions(
482 env, observer_, category.id(), 486 env, observer_, category.id(),
483 ToJavaSuggestionList(env, category, suggestions)); 487 ToJavaSuggestionList(env, category, suggestions));
484 } 488 }
485 489
486 // static 490 // static
487 bool NTPSnippetsBridge::Register(JNIEnv* env) { 491 bool NTPSnippetsBridge::Register(JNIEnv* env) {
488 return RegisterNativesImpl(env); 492 return RegisterNativesImpl(env);
489 } 493 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698