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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxSuggestion.java

Issue 815273002: Remove and deprecate SEARCH_SUGGEST_ANSWER (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated with Justin's suggestions Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxSuggestion.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxSuggestion.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxSuggestion.java
index df24013c098d9e713845e7896ddac29d14350ffc..af48a956041424b01ba9a0b71e3f40bc470f1d1a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxSuggestion.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxSuggestion.java
@@ -34,29 +34,30 @@ public class OmniboxSuggestion {
* Negative types are specific to Chrome on Android front-end.
*/
public static enum Type {
- VOICE_SUGGEST (-100), // A suggested search from the voice recognizer.
-
- URL_WHAT_YOU_TYPED (0), // The input as a URL.
- HISTORY_URL (1), // A past page whose URL contains the input.
- HISTORY_TITLE (2), // A past page whose title contains the input.
- HISTORY_BODY (3), // A past page whose body contains the input.
- HISTORY_KEYWORD (4), // A past page whose keyword contains the input.
- NAVSUGGEST (5), // A suggested URL.
- SEARCH_WHAT_YOU_TYPED (6), // The input as a search query (with the default
- // engine).
- SEARCH_HISTORY (7), // A past search (with the default engine)
- // containing the input.
- SEARCH_SUGGEST (8), // A suggested search (with the default engine).
- SEARCH_SUGGEST_ENTITY (9), // A suggested search for an entity.
- SEARCH_SUGGEST_INFINITE (10), // A suggested search (with the default engine)
- // to complete the tail part of the input.
+ VOICE_SUGGEST (-100), // A suggested search from the voice recognizer.
groby-ooo-7-16 2014/12/23 20:15:22 Please don't change whitespace just for alignments
+
+ URL_WHAT_YOU_TYPED (0), // The input as a URL.
+ HISTORY_URL (1), // A past page whose URL contains the input.
+ HISTORY_TITLE (2), // A past page whose title contains the input.
+ HISTORY_BODY (3), // A past page whose body contains the input.
+ HISTORY_KEYWORD (4), // A past page whose keyword contains the input.
+ NAVSUGGEST (5), // A suggested URL.
+ SEARCH_WHAT_YOU_TYPED (6), // The input as a search query (with the default
+ // engine).
+ SEARCH_HISTORY (7), // A past search (with the default engine)
+ // containing the input.
+ SEARCH_SUGGEST (8), // A suggested search (with the default engine).
+ SEARCH_SUGGEST_ENTITY (9), // A suggested search for an entity.
+ SEARCH_SUGGEST_INFINITE (10), // A suggested search (with the default engine)
+ // to complete the tail part of the input.
SEARCH_SUGGEST_PERSONALIZED (11), // A personalized suggested search.
- SEARCH_SUGGEST_PROFILE (12), // A personalized suggested search for a
- // Google+ profile.
- SEARCH_OTHER_ENGINE (13), // A search with a non-default engine.
- OPEN_HISTORY_PAGE (17), // A synthetic result that opens the history page
- // to search for the input.
- SEARCH_SUGGEST_ANSWER (18); // A short result for a suggested search.
+ SEARCH_SUGGEST_PROFILE (12), // A personalized suggested search for a
+ // Google+ profile.
+ SEARCH_OTHER_ENGINE (13), // A search with a non-default engine.
+ OPEN_HISTORY_PAGE (17), // A synthetic result that opens the history page
+ // to search for the input.
+ SEARCH_SUGGEST_ANSWER (18); // TODO(dschuyler): Remove once references to
groby-ooo-7-16 2014/12/23 20:15:22 You might want to consider filing a bug instead, a
+ // this have been removed from the Java UI code.
private final int mNativeType;
@@ -73,8 +74,8 @@ public class OmniboxSuggestion {
}
public boolean isHistoryUrl() {
- return this == HISTORY_URL || this == HISTORY_TITLE ||
- this == HISTORY_BODY || this == HISTORY_KEYWORD;
+ return this == HISTORY_URL || this == HISTORY_TITLE
+ || this == HISTORY_BODY || this == HISTORY_KEYWORD;
groby-ooo-7-16 2014/12/23 20:15:22 Again, please don't commit style-only changes.
Justin Donnelly 2014/12/23 21:08:40 Is it the number of lines touched that's a problem
groby-ooo-7-16 2014/12/23 21:12:35 It's unrelated code. But, as Dave pointed out, it
}
public boolean isUrl() {
@@ -188,8 +189,8 @@ public class OmniboxSuggestion {
@Override
public int hashCode() {
- int hash = 37 * mType.mNativeType + mDisplayText.hashCode() + mFillIntoEdit.hashCode() +
- (mIsStarred ? 1 : 0) + (mIsDeletable ? 1 : 0);
+ int hash = 37 * mType.mNativeType + mDisplayText.hashCode() + mFillIntoEdit.hashCode()
+ + (mIsStarred ? 1 : 0) + (mIsDeletable ? 1 : 0);
if (mAnswerContents != null) {
hash = hash + mAnswerContents.hashCode();
}
@@ -205,10 +206,10 @@ public class OmniboxSuggestion {
OmniboxSuggestion suggestion = (OmniboxSuggestion) obj;
boolean answersAreEqual =
- (mAnswerContents == null && suggestion.mAnswerContents == null) ||
- (mAnswerContents != null &&
- suggestion.mAnswerContents != null &&
- mAnswerContents.equals(suggestion.mAnswerContents));
+ (mAnswerContents == null && suggestion.mAnswerContents == null)
groby-ooo-7-16 2014/12/23 20:15:22 See above. If you feel you truly must change the s
+ || (mAnswerContents != null
+ && suggestion.mAnswerContents != null
+ && mAnswerContents.equals(suggestion.mAnswerContents));
return mType == suggestion.mType
&& mFillIntoEdit.equals(suggestion.mFillIntoEdit)
&& mDisplayText.equals(suggestion.mDisplayText)
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_controller.cc » ('j') | components/omnibox/autocomplete_match.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698