| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 const base::string16& annotation, | 118 const base::string16& annotation, |
| 119 const base::string16& answer_contents, | 119 const base::string16& answer_contents, |
| 120 const base::string16& answer_type, | 120 const base::string16& answer_type, |
| 121 const std::string& suggest_query_params, | 121 const std::string& suggest_query_params, |
| 122 const std::string& deletion_url, | 122 const std::string& deletion_url, |
| 123 bool from_keyword_provider, | 123 bool from_keyword_provider, |
| 124 int relevance, | 124 int relevance, |
| 125 bool relevance_from_server, | 125 bool relevance_from_server, |
| 126 bool should_prefetch, | 126 bool should_prefetch, |
| 127 const base::string16& input_text); | 127 const base::string16& input_text); |
| 128 virtual ~SuggestResult(); | 128 ~SuggestResult() override; |
| 129 | 129 |
| 130 const base::string16& suggestion() const { return suggestion_; } | 130 const base::string16& suggestion() const { return suggestion_; } |
| 131 const base::string16& match_contents_prefix() const { | 131 const base::string16& match_contents_prefix() const { |
| 132 return match_contents_prefix_; | 132 return match_contents_prefix_; |
| 133 } | 133 } |
| 134 const base::string16& annotation() const { return annotation_; } | 134 const base::string16& annotation() const { return annotation_; } |
| 135 const std::string& suggest_query_params() const { | 135 const std::string& suggest_query_params() const { |
| 136 return suggest_query_params_; | 136 return suggest_query_params_; |
| 137 } | 137 } |
| 138 | 138 |
| 139 const base::string16& answer_contents() const { return answer_contents_; } | 139 const base::string16& answer_contents() const { return answer_contents_; } |
| 140 const base::string16& answer_type() const { return answer_type_; } | 140 const base::string16& answer_type() const { return answer_type_; } |
| 141 | 141 |
| 142 bool should_prefetch() const { return should_prefetch_; } | 142 bool should_prefetch() const { return should_prefetch_; } |
| 143 | 143 |
| 144 // Fills in |match_contents_class_| to reflect how |match_contents_| should | 144 // Fills in |match_contents_class_| to reflect how |match_contents_| should |
| 145 // be displayed and bolded against the current |input_text|. If | 145 // be displayed and bolded against the current |input_text|. If |
| 146 // |allow_bolding_all| is false and |match_contents_class_| would have all | 146 // |allow_bolding_all| is false and |match_contents_class_| would have all |
| 147 // of |match_contents_| bolded, do nothing. | 147 // of |match_contents_| bolded, do nothing. |
| 148 void ClassifyMatchContents(const bool allow_bolding_all, | 148 void ClassifyMatchContents(const bool allow_bolding_all, |
| 149 const base::string16& input_text); | 149 const base::string16& input_text); |
| 150 | 150 |
| 151 // Result: | 151 // Result: |
| 152 virtual int CalculateRelevance( | 152 int CalculateRelevance(const AutocompleteInput& input, |
| 153 const AutocompleteInput& input, | 153 bool keyword_provider_requested) const override; |
| 154 bool keyword_provider_requested) const override; | |
| 155 | 154 |
| 156 private: | 155 private: |
| 157 // The search terms to be used for this suggestion. | 156 // The search terms to be used for this suggestion. |
| 158 base::string16 suggestion_; | 157 base::string16 suggestion_; |
| 159 | 158 |
| 160 // The contents to be displayed as prefix of match contents. | 159 // The contents to be displayed as prefix of match contents. |
| 161 // Used for postfix suggestions to display a leading ellipsis (or some | 160 // Used for postfix suggestions to display a leading ellipsis (or some |
| 162 // equivalent character) to indicate omitted text. | 161 // equivalent character) to indicate omitted text. |
| 163 // Only used to pass this information to about:omnibox's "Additional Info". | 162 // Only used to pass this information to about:omnibox's "Additional Info". |
| 164 base::string16 match_contents_prefix_; | 163 base::string16 match_contents_prefix_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 186 NavigationResult(const AutocompleteSchemeClassifier& scheme_classifier, | 185 NavigationResult(const AutocompleteSchemeClassifier& scheme_classifier, |
| 187 const GURL& url, | 186 const GURL& url, |
| 188 AutocompleteMatchType::Type type, | 187 AutocompleteMatchType::Type type, |
| 189 const base::string16& description, | 188 const base::string16& description, |
| 190 const std::string& deletion_url, | 189 const std::string& deletion_url, |
| 191 bool from_keyword_provider, | 190 bool from_keyword_provider, |
| 192 int relevance, | 191 int relevance, |
| 193 bool relevance_from_server, | 192 bool relevance_from_server, |
| 194 const base::string16& input_text, | 193 const base::string16& input_text, |
| 195 const std::string& languages); | 194 const std::string& languages); |
| 196 virtual ~NavigationResult(); | 195 ~NavigationResult() override; |
| 197 | 196 |
| 198 const GURL& url() const { return url_; } | 197 const GURL& url() const { return url_; } |
| 199 const base::string16& description() const { return description_; } | 198 const base::string16& description() const { return description_; } |
| 200 const base::string16& formatted_url() const { return formatted_url_; } | 199 const base::string16& formatted_url() const { return formatted_url_; } |
| 201 | 200 |
| 202 // Fills in |match_contents_| and |match_contents_class_| to reflect how | 201 // Fills in |match_contents_| and |match_contents_class_| to reflect how |
| 203 // the URL should be displayed and bolded against the current |input_text| | 202 // the URL should be displayed and bolded against the current |input_text| |
| 204 // and user |languages|. If |allow_bolding_nothing| is false and | 203 // and user |languages|. If |allow_bolding_nothing| is false and |
| 205 // |match_contents_class_| would result in an entirely unbolded | 204 // |match_contents_class_| would result in an entirely unbolded |
| 206 // |match_contents_|, do nothing. | 205 // |match_contents_|, do nothing. |
| 207 void CalculateAndClassifyMatchContents(const bool allow_bolding_nothing, | 206 void CalculateAndClassifyMatchContents(const bool allow_bolding_nothing, |
| 208 const base::string16& input_text, | 207 const base::string16& input_text, |
| 209 const std::string& languages); | 208 const std::string& languages); |
| 210 | 209 |
| 211 // Result: | 210 // Result: |
| 212 virtual int CalculateRelevance( | 211 int CalculateRelevance(const AutocompleteInput& input, |
| 213 const AutocompleteInput& input, | 212 bool keyword_provider_requested) const override; |
| 214 bool keyword_provider_requested) const override; | |
| 215 | 213 |
| 216 private: | 214 private: |
| 217 // The suggested url for navigation. | 215 // The suggested url for navigation. |
| 218 GURL url_; | 216 GURL url_; |
| 219 | 217 |
| 220 // The properly formatted ("fixed up") URL string with equivalent meaning | 218 // The properly formatted ("fixed up") URL string with equivalent meaning |
| 221 // to the one in |url_|. | 219 // to the one in |url_|. |
| 222 base::string16 formatted_url_; | 220 base::string16 formatted_url_; |
| 223 | 221 |
| 224 // The suggested navigational result description; generally the site name. | 222 // The suggested navigational result description; generally the site name. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 GetAnswersImageURLsWithValidImage); | 298 GetAnswersImageURLsWithValidImage); |
| 301 | 299 |
| 302 // Gets URLs of any images in Answers results. | 300 // Gets URLs of any images in Answers results. |
| 303 static void GetAnswersImageURLs(const base::DictionaryValue* answer_json, | 301 static void GetAnswersImageURLs(const base::DictionaryValue* answer_json, |
| 304 std::vector<GURL>* urls); | 302 std::vector<GURL>* urls); |
| 305 | 303 |
| 306 DISALLOW_COPY_AND_ASSIGN(SearchSuggestionParser); | 304 DISALLOW_COPY_AND_ASSIGN(SearchSuggestionParser); |
| 307 }; | 305 }; |
| 308 | 306 |
| 309 #endif // COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_ | 307 #endif // COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_ |
| OLD | NEW |