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

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: rebase 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 const base::android::JavaParamRef<jobject>& obj, 195 const base::android::JavaParamRef<jobject>& obj,
196 jint j_category_id) { 196 jint j_category_id) {
197 base::Optional<CategoryInfo> info = 197 base::Optional<CategoryInfo> info =
198 content_suggestions_service_->GetCategoryInfo( 198 content_suggestions_service_->GetCategoryInfo(
199 Category::FromIDValue(j_category_id)); 199 Category::FromIDValue(j_category_id));
200 if (!info) { 200 if (!info) {
201 return base::android::ScopedJavaLocalRef<jobject>(env, nullptr); 201 return base::android::ScopedJavaLocalRef<jobject>(env, nullptr);
202 } 202 }
203 return Java_SnippetsBridge_createSuggestionsCategoryInfo( 203 return Java_SnippetsBridge_createSuggestionsCategoryInfo(
204 env, j_category_id, ConvertUTF16ToJavaString(env, info->title()), 204 env, j_category_id, ConvertUTF16ToJavaString(env, info->title()),
205 static_cast<int>(info->card_layout()), info->has_more_action(), 205 static_cast<int>(info->card_layout()), info->has_fetch_action(),
206 info->has_reload_action(), info->has_view_all_action(), 206 info->has_view_all_action(), info->show_if_empty(),
207 info->show_if_empty(),
208 ConvertUTF16ToJavaString(env, info->no_suggestions_message())); 207 ConvertUTF16ToJavaString(env, info->no_suggestions_message()));
209 } 208 }
210 209
211 ScopedJavaLocalRef<jobject> NTPSnippetsBridge::GetSuggestionsForCategory( 210 ScopedJavaLocalRef<jobject> NTPSnippetsBridge::GetSuggestionsForCategory(
212 JNIEnv* env, 211 JNIEnv* env,
213 const base::android::JavaParamRef<jobject>& obj, 212 const base::android::JavaParamRef<jobject>& obj,
214 jint j_category_id) { 213 jint j_category_id) {
215 Category category = Category::FromIDValue(j_category_id); 214 Category category = Category::FromIDValue(j_category_id);
216 return ToJavaSuggestionList( 215 return ToJavaSuggestionList(
217 env, category, 216 env, category,
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 JNIEnv* env = AttachCurrentThread(); 483 JNIEnv* env = AttachCurrentThread();
485 Java_SnippetsBridge_onMoreSuggestions( 484 Java_SnippetsBridge_onMoreSuggestions(
486 env, bridge_, category.id(), 485 env, bridge_, category.id(),
487 ToJavaSuggestionList(env, category, suggestions)); 486 ToJavaSuggestionList(env, category, suggestions));
488 } 487 }
489 488
490 // static 489 // static
491 bool NTPSnippetsBridge::Register(JNIEnv* env) { 490 bool NTPSnippetsBridge::Register(JNIEnv* env) {
492 return RegisterNativesImpl(env); 491 return RegisterNativesImpl(env);
493 } 492 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698