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

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

Issue 2232783002: Support action button to fetch more content suggestions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@snippetsbridge
Patch Set: Indent comments Created 4 years, 4 months 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 8
9 #include "base/android/callback_android.h" 9 #include "base/android/callback_android.h"
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 const base::android::JavaParamRef<jobject>& obj, 134 const base::android::JavaParamRef<jobject>& obj,
135 jint category) { 135 jint category) {
136 base::Optional<CategoryInfo> info = 136 base::Optional<CategoryInfo> info =
137 content_suggestions_service_->GetCategoryInfo( 137 content_suggestions_service_->GetCategoryInfo(
138 content_suggestions_service_->category_factory()->FromIDValue( 138 content_suggestions_service_->category_factory()->FromIDValue(
139 category)); 139 category));
140 if (!info) 140 if (!info)
141 return base::android::ScopedJavaLocalRef<jobject>(env, nullptr); 141 return base::android::ScopedJavaLocalRef<jobject>(env, nullptr);
142 return Java_SnippetsBridge_createSuggestionsCategoryInfo( 142 return Java_SnippetsBridge_createSuggestionsCategoryInfo(
143 env, ConvertUTF16ToJavaString(env, info->title()).obj(), 143 env, ConvertUTF16ToJavaString(env, info->title()).obj(),
144 static_cast<int>(info->card_layout())); 144 static_cast<int>(info->card_layout()), info->has_more_button());
145 } 145 }
146 146
147 ScopedJavaLocalRef<jobject> NTPSnippetsBridge::GetSuggestionsForCategory( 147 ScopedJavaLocalRef<jobject> NTPSnippetsBridge::GetSuggestionsForCategory(
148 JNIEnv* env, 148 JNIEnv* env,
149 const base::android::JavaParamRef<jobject>& obj, 149 const base::android::JavaParamRef<jobject>& obj,
150 jint category) { 150 jint category) {
151 const std::vector<ContentSuggestion>& suggestions = 151 const std::vector<ContentSuggestion>& suggestions =
152 content_suggestions_service_->GetSuggestionsForCategory( 152 content_suggestions_service_->GetSuggestionsForCategory(
153 content_suggestions_service_->category_factory()->FromIDValue( 153 content_suggestions_service_->category_factory()->FromIDValue(
154 category)); 154 category));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 if (!image.IsEmpty()) 232 if (!image.IsEmpty())
233 j_bitmap = gfx::ConvertToJavaBitmap(image.ToSkBitmap()); 233 j_bitmap = gfx::ConvertToJavaBitmap(image.ToSkBitmap());
234 234
235 base::android::RunCallbackAndroid(callback, j_bitmap); 235 base::android::RunCallbackAndroid(callback, j_bitmap);
236 } 236 }
237 237
238 // static 238 // static
239 bool NTPSnippetsBridge::Register(JNIEnv* env) { 239 bool NTPSnippetsBridge::Register(JNIEnv* env) {
240 return RegisterNativesImpl(env); 240 return RegisterNativesImpl(env);
241 } 241 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698