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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 bool from_keyword_provider() const { return from_keyword_provider_; } | 48 bool from_keyword_provider() const { return from_keyword_provider_; } |
49 | 49 |
50 const base::string16& match_contents() const { return match_contents_; } | 50 const base::string16& match_contents() const { return match_contents_; } |
51 const ACMatchClassifications& match_contents_class() const { | 51 const ACMatchClassifications& match_contents_class() const { |
52 return match_contents_class_; | 52 return match_contents_class_; |
53 } | 53 } |
54 | 54 |
55 AutocompleteMatchType::Type type() const { return type_; } | 55 AutocompleteMatchType::Type type() const { return type_; } |
56 int relevance() const { return relevance_; } | 56 int relevance() const { return relevance_; } |
57 void set_relevance(int relevance) { relevance_ = relevance; } | 57 void set_relevance(int relevance) { relevance_ = relevance; } |
| 58 bool received_after_last_keystroke() const { |
| 59 return received_after_last_keystroke_; |
| 60 } |
| 61 void set_received_after_last_keystroke( |
| 62 bool received_after_last_keystroke) { |
| 63 received_after_last_keystroke_ = received_after_last_keystroke; |
| 64 } |
58 | 65 |
59 bool relevance_from_server() const { return relevance_from_server_; } | 66 bool relevance_from_server() const { return relevance_from_server_; } |
60 void set_relevance_from_server(bool relevance_from_server) { | 67 void set_relevance_from_server(bool relevance_from_server) { |
61 relevance_from_server_ = relevance_from_server; | 68 relevance_from_server_ = relevance_from_server; |
62 } | 69 } |
63 | 70 |
64 const std::string& deletion_url() const { return deletion_url_; } | 71 const std::string& deletion_url() const { return deletion_url_; } |
65 | 72 |
66 // Returns the default relevance value for this result (which may | 73 // Returns the default relevance value for this result (which may |
67 // be left over from a previous omnibox input) given the current | 74 // be left over from a previous omnibox input) given the current |
(...skipping 16 matching lines...) Expand all Loading... |
84 int relevance_; | 91 int relevance_; |
85 | 92 |
86 private: | 93 private: |
87 // Whether this result's relevance score was fully or partly calculated | 94 // Whether this result's relevance score was fully or partly calculated |
88 // based on server information, and thus is assumed to be more accurate. | 95 // based on server information, and thus is assumed to be more accurate. |
89 // This is ultimately used in | 96 // This is ultimately used in |
90 // SearchProvider::ConvertResultsToAutocompleteMatches(), see comments | 97 // SearchProvider::ConvertResultsToAutocompleteMatches(), see comments |
91 // there. | 98 // there. |
92 bool relevance_from_server_; | 99 bool relevance_from_server_; |
93 | 100 |
| 101 // Whether this result was received asynchronously after the last |
| 102 // keystroke, otherwise it must have come from prior cached results |
| 103 // or from a synchronous provider. |
| 104 bool received_after_last_keystroke_; |
| 105 |
94 // Optional deletion URL provided with suggestions. Fetching this URL | 106 // Optional deletion URL provided with suggestions. Fetching this URL |
95 // should result in some reasonable deletion behaviour on the server, | 107 // should result in some reasonable deletion behaviour on the server, |
96 // e.g. deleting this term out of a user's server-side search history. | 108 // e.g. deleting this term out of a user's server-side search history. |
97 std::string deletion_url_; | 109 std::string deletion_url_; |
98 }; | 110 }; |
99 | 111 |
100 class SuggestResult : public Result { | 112 class SuggestResult : public Result { |
101 public: | 113 public: |
102 SuggestResult(const base::string16& suggestion, | 114 SuggestResult(const base::string16& suggestion, |
103 AutocompleteMatchType::Type type, | 115 AutocompleteMatchType::Type type, |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 GetAnswersImageURLsWithValidImage); | 300 GetAnswersImageURLsWithValidImage); |
289 | 301 |
290 // Gets URLs of any images in Answers results. | 302 // Gets URLs of any images in Answers results. |
291 static void GetAnswersImageURLs(const base::DictionaryValue* answer_json, | 303 static void GetAnswersImageURLs(const base::DictionaryValue* answer_json, |
292 std::vector<GURL>* urls); | 304 std::vector<GURL>* urls); |
293 | 305 |
294 DISALLOW_COPY_AND_ASSIGN(SearchSuggestionParser); | 306 DISALLOW_COPY_AND_ASSIGN(SearchSuggestionParser); |
295 }; | 307 }; |
296 | 308 |
297 #endif // COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_ | 309 #endif // COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_ |
OLD | NEW |