Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_ | 5 #ifndef COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_ |
| 6 #define COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_ | 6 #define COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 bool from_keyword_provider() const { return from_keyword_provider_; } | 47 bool from_keyword_provider() const { return from_keyword_provider_; } |
| 48 | 48 |
| 49 const base::string16& match_contents() const { return match_contents_; } | 49 const base::string16& match_contents() const { return match_contents_; } |
| 50 const ACMatchClassifications& match_contents_class() const { | 50 const ACMatchClassifications& match_contents_class() const { |
| 51 return match_contents_class_; | 51 return match_contents_class_; |
| 52 } | 52 } |
| 53 | 53 |
| 54 AutocompleteMatchType::Type type() const { return type_; } | 54 AutocompleteMatchType::Type type() const { return type_; } |
| 55 int relevance() const { return relevance_; } | 55 int relevance() const { return relevance_; } |
| 56 void set_relevance(int relevance) { relevance_ = relevance; } | 56 void set_relevance(int relevance) { relevance_ = relevance; } |
| 57 bool received_after_last_keystroke() const { | |
| 58 return received_after_last_keystroke_; | |
| 59 } | |
| 60 void set_received_after_last_keystroke( | |
| 61 bool received_after_last_keystroke) { | |
| 62 received_after_last_keystroke_ = received_after_last_keystroke; | |
| 63 } | |
| 57 | 64 |
| 58 bool relevance_from_server() const { return relevance_from_server_; } | 65 bool relevance_from_server() const { return relevance_from_server_; } |
| 59 void set_relevance_from_server(bool relevance_from_server) { | 66 void set_relevance_from_server(bool relevance_from_server) { |
| 60 relevance_from_server_ = relevance_from_server; | 67 relevance_from_server_ = relevance_from_server; |
| 61 } | 68 } |
| 62 | 69 |
| 63 const std::string& deletion_url() const { return deletion_url_; } | 70 const std::string& deletion_url() const { return deletion_url_; } |
| 64 | 71 |
| 65 // Returns the default relevance value for this result (which may | 72 // Returns the default relevance value for this result (which may |
| 66 // be left over from a previous omnibox input) given the current | 73 // be left over from a previous omnibox input) given the current |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 83 int relevance_; | 90 int relevance_; |
| 84 | 91 |
| 85 private: | 92 private: |
| 86 // Whether this result's relevance score was fully or partly calculated | 93 // Whether this result's relevance score was fully or partly calculated |
| 87 // based on server information, and thus is assumed to be more accurate. | 94 // based on server information, and thus is assumed to be more accurate. |
| 88 // This is ultimately used in | 95 // This is ultimately used in |
| 89 // SearchProvider::ConvertResultsToAutocompleteMatches(), see comments | 96 // SearchProvider::ConvertResultsToAutocompleteMatches(), see comments |
| 90 // there. | 97 // there. |
| 91 bool relevance_from_server_; | 98 bool relevance_from_server_; |
| 92 | 99 |
| 100 // Whether this result was received asynchronously after the last | |
| 101 // keystroke, otherwise it must have come from prior cached results. | |
|
msw
2014/08/15 21:04:39
nit: or from a synchronous provider, right?
Mark P
2014/08/15 22:09:22
Nice clarification. Added.
| |
| 102 bool received_after_last_keystroke_; | |
| 103 | |
| 93 // Optional deletion URL provided with suggestions. Fetching this URL | 104 // Optional deletion URL provided with suggestions. Fetching this URL |
| 94 // should result in some reasonable deletion behaviour on the server, | 105 // should result in some reasonable deletion behaviour on the server, |
| 95 // e.g. deleting this term out of a user's server-side search history. | 106 // e.g. deleting this term out of a user's server-side search history. |
| 96 std::string deletion_url_; | 107 std::string deletion_url_; |
| 97 }; | 108 }; |
| 98 | 109 |
| 99 class SuggestResult : public Result { | 110 class SuggestResult : public Result { |
| 100 public: | 111 public: |
| 101 SuggestResult(const base::string16& suggestion, | 112 SuggestResult(const base::string16& suggestion, |
| 102 AutocompleteMatchType::Type type, | 113 AutocompleteMatchType::Type type, |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 | 293 |
| 283 private: | 294 private: |
| 284 // Gets URLs of any images in Answers results. | 295 // Gets URLs of any images in Answers results. |
| 285 static void GetAnswersImageURLs(const base::DictionaryValue* answer_json, | 296 static void GetAnswersImageURLs(const base::DictionaryValue* answer_json, |
| 286 std::vector<GURL>* urls); | 297 std::vector<GURL>* urls); |
| 287 | 298 |
| 288 DISALLOW_COPY_AND_ASSIGN(SearchSuggestionParser); | 299 DISALLOW_COPY_AND_ASSIGN(SearchSuggestionParser); |
| 289 }; | 300 }; |
| 290 | 301 |
| 291 #endif // COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_ | 302 #endif // COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_ |
| OLD | NEW |