| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "components/omnibox/browser/history_url_provider.h" | 5 #include "components/omnibox/browser/history_url_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 // UIThreadSearchTermsData but is subsequently safe to use on any thread. | 272 // UIThreadSearchTermsData but is subsequently safe to use on any thread. |
| 273 class SearchTermsDataSnapshot : public SearchTermsData { | 273 class SearchTermsDataSnapshot : public SearchTermsData { |
| 274 public: | 274 public: |
| 275 explicit SearchTermsDataSnapshot(const SearchTermsData& search_terms_data); | 275 explicit SearchTermsDataSnapshot(const SearchTermsData& search_terms_data); |
| 276 ~SearchTermsDataSnapshot() override; | 276 ~SearchTermsDataSnapshot() override; |
| 277 | 277 |
| 278 std::string GoogleBaseURLValue() const override; | 278 std::string GoogleBaseURLValue() const override; |
| 279 std::string GetApplicationLocale() const override; | 279 std::string GetApplicationLocale() const override; |
| 280 base::string16 GetRlzParameterValue(bool from_app_list) const override; | 280 base::string16 GetRlzParameterValue(bool from_app_list) const override; |
| 281 std::string GetSearchClient() const override; | 281 std::string GetSearchClient() const override; |
| 282 std::string InstantExtendedEnabledParam(bool for_search) const override; | 282 std::string InstantExtendedEnabledParam() const override; |
| 283 std::string ForceInstantResultsParam(bool for_prerender) const override; | 283 std::string ForceInstantResultsParam(bool for_prerender) const override; |
| 284 std::string GoogleImageSearchSource() const override; | 284 std::string GoogleImageSearchSource() const override; |
| 285 | 285 |
| 286 private: | 286 private: |
| 287 std::string google_base_url_value_; | 287 std::string google_base_url_value_; |
| 288 std::string application_locale_; | 288 std::string application_locale_; |
| 289 base::string16 rlz_parameter_value_; | 289 base::string16 rlz_parameter_value_; |
| 290 std::string search_client_; | 290 std::string search_client_; |
| 291 std::string instant_extended_enabled_param_; | 291 std::string instant_extended_enabled_param_; |
| 292 std::string instant_extended_enabled_param_for_search_; | |
| 293 std::string force_instant_results_param_; | 292 std::string force_instant_results_param_; |
| 294 std::string force_instant_results_param_for_prerender_; | 293 std::string force_instant_results_param_for_prerender_; |
| 295 std::string google_image_search_source_; | 294 std::string google_image_search_source_; |
| 296 | 295 |
| 297 DISALLOW_COPY_AND_ASSIGN(SearchTermsDataSnapshot); | 296 DISALLOW_COPY_AND_ASSIGN(SearchTermsDataSnapshot); |
| 298 }; | 297 }; |
| 299 | 298 |
| 300 SearchTermsDataSnapshot::SearchTermsDataSnapshot( | 299 SearchTermsDataSnapshot::SearchTermsDataSnapshot( |
| 301 const SearchTermsData& search_terms_data) | 300 const SearchTermsData& search_terms_data) |
| 302 : google_base_url_value_(search_terms_data.GoogleBaseURLValue()), | 301 : google_base_url_value_(search_terms_data.GoogleBaseURLValue()), |
| 303 application_locale_(search_terms_data.GetApplicationLocale()), | 302 application_locale_(search_terms_data.GetApplicationLocale()), |
| 304 rlz_parameter_value_(search_terms_data.GetRlzParameterValue(false)), | 303 rlz_parameter_value_(search_terms_data.GetRlzParameterValue(false)), |
| 305 search_client_(search_terms_data.GetSearchClient()), | 304 search_client_(search_terms_data.GetSearchClient()), |
| 306 instant_extended_enabled_param_( | 305 instant_extended_enabled_param_( |
| 307 search_terms_data.InstantExtendedEnabledParam(false)), | 306 search_terms_data.InstantExtendedEnabledParam()), |
| 308 instant_extended_enabled_param_for_search_( | |
| 309 search_terms_data.InstantExtendedEnabledParam(true)), | |
| 310 force_instant_results_param_( | 307 force_instant_results_param_( |
| 311 search_terms_data.ForceInstantResultsParam(false)), | 308 search_terms_data.ForceInstantResultsParam(false)), |
| 312 force_instant_results_param_for_prerender_( | 309 force_instant_results_param_for_prerender_( |
| 313 search_terms_data.ForceInstantResultsParam(true)), | 310 search_terms_data.ForceInstantResultsParam(true)), |
| 314 google_image_search_source_(search_terms_data.GoogleImageSearchSource()) { | 311 google_image_search_source_(search_terms_data.GoogleImageSearchSource()) { |
| 315 } | 312 } |
| 316 | 313 |
| 317 SearchTermsDataSnapshot::~SearchTermsDataSnapshot() { | 314 SearchTermsDataSnapshot::~SearchTermsDataSnapshot() { |
| 318 } | 315 } |
| 319 | 316 |
| 320 std::string SearchTermsDataSnapshot::GoogleBaseURLValue() const { | 317 std::string SearchTermsDataSnapshot::GoogleBaseURLValue() const { |
| 321 return google_base_url_value_; | 318 return google_base_url_value_; |
| 322 } | 319 } |
| 323 | 320 |
| 324 std::string SearchTermsDataSnapshot::GetApplicationLocale() const { | 321 std::string SearchTermsDataSnapshot::GetApplicationLocale() const { |
| 325 return application_locale_; | 322 return application_locale_; |
| 326 } | 323 } |
| 327 | 324 |
| 328 base::string16 SearchTermsDataSnapshot::GetRlzParameterValue( | 325 base::string16 SearchTermsDataSnapshot::GetRlzParameterValue( |
| 329 bool from_app_list) const { | 326 bool from_app_list) const { |
| 330 return rlz_parameter_value_; | 327 return rlz_parameter_value_; |
| 331 } | 328 } |
| 332 | 329 |
| 333 std::string SearchTermsDataSnapshot::GetSearchClient() const { | 330 std::string SearchTermsDataSnapshot::GetSearchClient() const { |
| 334 return search_client_; | 331 return search_client_; |
| 335 } | 332 } |
| 336 | 333 |
| 337 std::string SearchTermsDataSnapshot::InstantExtendedEnabledParam( | 334 std::string SearchTermsDataSnapshot::InstantExtendedEnabledParam() const { |
| 338 bool for_search) const { | 335 return instant_extended_enabled_param_; |
| 339 return for_search ? instant_extended_enabled_param_ : | |
| 340 instant_extended_enabled_param_for_search_; | |
| 341 } | 336 } |
| 342 | 337 |
| 343 std::string SearchTermsDataSnapshot::ForceInstantResultsParam( | 338 std::string SearchTermsDataSnapshot::ForceInstantResultsParam( |
| 344 bool for_prerender) const { | 339 bool for_prerender) const { |
| 345 return for_prerender ? force_instant_results_param_ : | 340 return for_prerender ? force_instant_results_param_ : |
| 346 force_instant_results_param_for_prerender_; | 341 force_instant_results_param_for_prerender_; |
| 347 } | 342 } |
| 348 | 343 |
| 349 std::string SearchTermsDataSnapshot::GoogleImageSearchSource() const { | 344 std::string SearchTermsDataSnapshot::GoogleImageSearchSource() const { |
| 350 return google_image_search_source_; | 345 return google_image_search_source_; |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, | 1187 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, |
| 1193 match.contents.length(), ACMatchClassification::URL, | 1188 match.contents.length(), ACMatchClassification::URL, |
| 1194 &match.contents_class); | 1189 &match.contents_class); |
| 1195 } | 1190 } |
| 1196 match.description = info.title(); | 1191 match.description = info.title(); |
| 1197 match.description_class = | 1192 match.description_class = |
| 1198 ClassifyDescription(params.input.text(), match.description); | 1193 ClassifyDescription(params.input.text(), match.description); |
| 1199 RecordAdditionalInfoFromUrlRow(info, &match); | 1194 RecordAdditionalInfoFromUrlRow(info, &match); |
| 1200 return match; | 1195 return match; |
| 1201 } | 1196 } |
| OLD | NEW |