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 |
| 102 // or from a synchronous provider. |
| 103 bool received_after_last_keystroke_; |
| 104 |
93 // Optional deletion URL provided with suggestions. Fetching this URL | 105 // Optional deletion URL provided with suggestions. Fetching this URL |
94 // should result in some reasonable deletion behaviour on the server, | 106 // 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. | 107 // e.g. deleting this term out of a user's server-side search history. |
96 std::string deletion_url_; | 108 std::string deletion_url_; |
97 }; | 109 }; |
98 | 110 |
99 class SuggestResult : public Result { | 111 class SuggestResult : public Result { |
100 public: | 112 public: |
101 SuggestResult(const base::string16& suggestion, | 113 SuggestResult(const base::string16& suggestion, |
102 AutocompleteMatchType::Type type, | 114 AutocompleteMatchType::Type type, |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 294 |
283 private: | 295 private: |
284 // Gets URLs of any images in Answers results. | 296 // Gets URLs of any images in Answers results. |
285 static void GetAnswersImageURLs(const base::DictionaryValue* answer_json, | 297 static void GetAnswersImageURLs(const base::DictionaryValue* answer_json, |
286 std::vector<GURL>* urls); | 298 std::vector<GURL>* urls); |
287 | 299 |
288 DISALLOW_COPY_AND_ASSIGN(SearchSuggestionParser); | 300 DISALLOW_COPY_AND_ASSIGN(SearchSuggestionParser); |
289 }; | 301 }; |
290 | 302 |
291 #endif // COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_ | 303 #endif // COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_ |
OLD | NEW |