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

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

Issue 2663313002: 📰 Merge the has_fetch_more and has_reload actions (Closed)
Patch Set: fix tests pt 2 Created 3 years, 10 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 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 const base::android::JavaParamRef<jobject>& obj, 196 const base::android::JavaParamRef<jobject>& obj,
197 jint j_category_id) { 197 jint j_category_id) {
198 base::Optional<CategoryInfo> info = 198 base::Optional<CategoryInfo> info =
199 content_suggestions_service_->GetCategoryInfo( 199 content_suggestions_service_->GetCategoryInfo(
200 Category::FromIDValue(j_category_id)); 200 Category::FromIDValue(j_category_id));
201 if (!info) { 201 if (!info) {
202 return base::android::ScopedJavaLocalRef<jobject>(env, nullptr); 202 return base::android::ScopedJavaLocalRef<jobject>(env, nullptr);
203 } 203 }
204 return Java_SnippetsBridge_createSuggestionsCategoryInfo( 204 return Java_SnippetsBridge_createSuggestionsCategoryInfo(
205 env, j_category_id, ConvertUTF16ToJavaString(env, info->title()), 205 env, j_category_id, ConvertUTF16ToJavaString(env, info->title()),
206 static_cast<int>(info->card_layout()), info->has_more_action(), 206 static_cast<int>(info->card_layout()), info->has_fetch_action(),
207 info->has_reload_action(), info->has_view_all_action(), 207 info->has_view_all_action(), info->show_if_empty(),
208 info->show_if_empty(),
209 ConvertUTF16ToJavaString(env, info->no_suggestions_message())); 208 ConvertUTF16ToJavaString(env, info->no_suggestions_message()));
210 } 209 }
211 210
212 ScopedJavaLocalRef<jobject> NTPSnippetsBridge::GetSuggestionsForCategory( 211 ScopedJavaLocalRef<jobject> NTPSnippetsBridge::GetSuggestionsForCategory(
213 JNIEnv* env, 212 JNIEnv* env,
214 const base::android::JavaParamRef<jobject>& obj, 213 const base::android::JavaParamRef<jobject>& obj,
215 jint j_category_id) { 214 jint j_category_id) {
216 Category category = Category::FromIDValue(j_category_id); 215 Category category = Category::FromIDValue(j_category_id);
217 return ToJavaSuggestionList( 216 return ToJavaSuggestionList(
218 env, category, 217 env, category,
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 JNIEnv* env = AttachCurrentThread(); 484 JNIEnv* env = AttachCurrentThread();
486 Java_SnippetsBridge_onMoreSuggestions( 485 Java_SnippetsBridge_onMoreSuggestions(
487 env, bridge_, category.id(), 486 env, bridge_, category.id(),
488 ToJavaSuggestionList(env, category, suggestions)); 487 ToJavaSuggestionList(env, category, suggestions));
489 } 488 }
490 489
491 // static 490 // static
492 bool NTPSnippetsBridge::Register(JNIEnv* env) { 491 bool NTPSnippetsBridge::Register(JNIEnv* env) {
493 return RegisterNativesImpl(env); 492 return RegisterNativesImpl(env);
494 } 493 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698