| 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_BROWSER_SEARCH_SUGGESTION_PARSER_H_ | 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_SEARCH_SUGGESTION_PARSER_H_ |
| 6 #define COMPONENTS_OMNIBOX_BROWSER_SEARCH_SUGGESTION_PARSER_H_ | 6 #define COMPONENTS_OMNIBOX_BROWSER_SEARCH_SUGGESTION_PARSER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 class NavigationResult : public Result { | 195 class NavigationResult : public Result { |
| 196 public: | 196 public: |
| 197 NavigationResult(const AutocompleteSchemeClassifier& scheme_classifier, | 197 NavigationResult(const AutocompleteSchemeClassifier& scheme_classifier, |
| 198 const GURL& url, | 198 const GURL& url, |
| 199 AutocompleteMatchType::Type type, | 199 AutocompleteMatchType::Type type, |
| 200 const base::string16& description, | 200 const base::string16& description, |
| 201 const std::string& deletion_url, | 201 const std::string& deletion_url, |
| 202 bool from_keyword_provider, | 202 bool from_keyword_provider, |
| 203 int relevance, | 203 int relevance, |
| 204 bool relevance_from_server, | 204 bool relevance_from_server, |
| 205 const base::string16& input_text, | 205 const base::string16& input_text); |
| 206 const std::string& languages); | |
| 207 ~NavigationResult() override; | 206 ~NavigationResult() override; |
| 208 | 207 |
| 209 const GURL& url() const { return url_; } | 208 const GURL& url() const { return url_; } |
| 210 const base::string16& description() const { return description_; } | 209 const base::string16& description() const { return description_; } |
| 211 const base::string16& formatted_url() const { return formatted_url_; } | 210 const base::string16& formatted_url() const { return formatted_url_; } |
| 212 | 211 |
| 213 // Fills in |match_contents_| and |match_contents_class_| to reflect how | 212 // Fills in |match_contents_| and |match_contents_class_| to reflect how |
| 214 // the URL should be displayed and bolded against the current |input_text| | 213 // the URL should be displayed and bolded against the current |input_text|. |
| 215 // and user |languages|. If |allow_bolding_nothing| is false and | 214 // If |allow_bolding_nothing| is false and |match_contents_class_| would |
| 216 // |match_contents_class_| would result in an entirely unbolded | 215 // result in an entirely unbolded |match_contents_|, do nothing. |
| 217 // |match_contents_|, do nothing. | |
| 218 void CalculateAndClassifyMatchContents(const bool allow_bolding_nothing, | 216 void CalculateAndClassifyMatchContents(const bool allow_bolding_nothing, |
| 219 const base::string16& input_text, | 217 const base::string16& input_text); |
| 220 const std::string& languages); | |
| 221 | 218 |
| 222 // Result: | 219 // Result: |
| 223 int CalculateRelevance(const AutocompleteInput& input, | 220 int CalculateRelevance(const AutocompleteInput& input, |
| 224 bool keyword_provider_requested) const override; | 221 bool keyword_provider_requested) const override; |
| 225 | 222 |
| 226 private: | 223 private: |
| 227 // The suggested url for navigation. | 224 // The suggested url for navigation. |
| 228 GURL url_; | 225 GURL url_; |
| 229 | 226 |
| 230 // The properly formatted ("fixed up") URL string with equivalent meaning | 227 // The properly formatted ("fixed up") URL string with equivalent meaning |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 290 |
| 294 // Parses results from the suggest server and updates the appropriate suggest | 291 // Parses results from the suggest server and updates the appropriate suggest |
| 295 // and navigation result lists in |results|. |is_keyword_result| indicates | 292 // and navigation result lists in |results|. |is_keyword_result| indicates |
| 296 // whether the response was received from the keyword provider. | 293 // whether the response was received from the keyword provider. |
| 297 // Returns whether the appropriate result list members were updated. | 294 // Returns whether the appropriate result list members were updated. |
| 298 static bool ParseSuggestResults( | 295 static bool ParseSuggestResults( |
| 299 const base::Value& root_val, | 296 const base::Value& root_val, |
| 300 const AutocompleteInput& input, | 297 const AutocompleteInput& input, |
| 301 const AutocompleteSchemeClassifier& scheme_classifier, | 298 const AutocompleteSchemeClassifier& scheme_classifier, |
| 302 int default_result_relevance, | 299 int default_result_relevance, |
| 303 const std::string& languages, | |
| 304 bool is_keyword_result, | 300 bool is_keyword_result, |
| 305 Results* results); | 301 Results* results); |
| 306 | 302 |
| 307 private: | 303 private: |
| 308 DISALLOW_COPY_AND_ASSIGN(SearchSuggestionParser); | 304 DISALLOW_COPY_AND_ASSIGN(SearchSuggestionParser); |
| 309 }; | 305 }; |
| 310 | 306 |
| 311 #endif // COMPONENTS_OMNIBOX_BROWSER_SEARCH_SUGGESTION_PARSER_H_ | 307 #endif // COMPONENTS_OMNIBOX_BROWSER_SEARCH_SUGGESTION_PARSER_H_ |
| OLD | NEW |