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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java

Issue 2274293002: 📰 Keep Suggestion sections in declaration order (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix render test Created 4 years, 3 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 package org.chromium.chrome.browser.ntp.snippets; 5 package org.chromium.chrome.browser.ntp.snippets;
6 6
7 import android.graphics.Bitmap; 7 import android.graphics.Bitmap;
8 8
9 import org.chromium.base.Callback; 9 import org.chromium.base.Callback;
10 import org.chromium.base.annotations.CalledByNative; 10 import org.chromium.base.annotations.CalledByNative;
(...skipping 11 matching lines...) Expand all
22 private static final String TAG = "SnippetsBridge"; 22 private static final String TAG = "SnippetsBridge";
23 23
24 private long mNativeSnippetsBridge; 24 private long mNativeSnippetsBridge;
25 private SuggestionsSource.Observer mObserver; 25 private SuggestionsSource.Observer mObserver;
26 26
27 public static boolean isCategoryStatusAvailable(@CategoryStatusEnum int stat us) { 27 public static boolean isCategoryStatusAvailable(@CategoryStatusEnum int stat us) {
28 // Note: This code is duplicated in content_suggestions_category_status. cc. 28 // Note: This code is duplicated in content_suggestions_category_status. cc.
29 return status == CategoryStatus.AVAILABLE_LOADING || status == CategoryS tatus.AVAILABLE; 29 return status == CategoryStatus.AVAILABLE_LOADING || status == CategoryS tatus.AVAILABLE;
30 } 30 }
31 31
32 public static boolean isCategoryStatusInitOrAvailable(@CategoryStatusEnum in t status) {
33 // Note: This code is duplicated in content_suggestions_category_status. cc.
34 return status == CategoryStatus.INITIALIZING || isCategoryStatusAvailabl e(status);
35 }
36
37 /** Returns whether the category is considered "enabled", and can show conte nt suggestions. */ 32 /** Returns whether the category is considered "enabled", and can show conte nt suggestions. */
38 public static boolean isCategoryEnabled(@CategoryStatusEnum int status) { 33 public static boolean isCategoryEnabled(@CategoryStatusEnum int status) {
39 switch (status) { 34 switch (status) {
40 case CategoryStatus.INITIALIZING: 35 case CategoryStatus.INITIALIZING:
41 case CategoryStatus.AVAILABLE: 36 case CategoryStatus.AVAILABLE:
42 case CategoryStatus.AVAILABLE_LOADING: 37 case CategoryStatus.AVAILABLE_LOADING:
43 case CategoryStatus.SIGNED_OUT: 38 case CategoryStatus.SIGNED_OUT:
44 return true; 39 return true;
45 } 40 }
46 return false; 41 return false;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 int category, int categoryPosition, long publishTimestampMs, float s core); 230 int category, int categoryPosition, long publishTimestampMs, float s core);
236 private native void nativeOnSuggestionOpened(long nativeNTPSnippetsBridge, i nt globalPosition, 231 private native void nativeOnSuggestionOpened(long nativeNTPSnippetsBridge, i nt globalPosition,
237 int category, int categoryPosition, long publishTimestampMs, float s core, 232 int category, int categoryPosition, long publishTimestampMs, float s core,
238 int windowOpenDisposition); 233 int windowOpenDisposition);
239 private native void nativeOnSuggestionMenuOpened(long nativeNTPSnippetsBridg e, 234 private native void nativeOnSuggestionMenuOpened(long nativeNTPSnippetsBridg e,
240 int globalPosition, int category, int categoryPosition, long publish TimestampMs, 235 int globalPosition, int category, int categoryPosition, long publish TimestampMs,
241 float score); 236 float score);
242 private static native void nativeOnSuggestionTargetVisited(int category, lon g visitTimeMs); 237 private static native void nativeOnSuggestionTargetVisited(int category, lon g visitTimeMs);
243 private native void nativeSetObserver(long nativeNTPSnippetsBridge, Snippets Bridge bridge); 238 private native void nativeSetObserver(long nativeNTPSnippetsBridge, Snippets Bridge bridge);
244 } 239 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698