| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |