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/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // UIThreadSearchTermsData but is subsequently safe to use on any thread. | 271 // UIThreadSearchTermsData but is subsequently safe to use on any thread. |
272 class SearchTermsDataSnapshot : public SearchTermsData { | 272 class SearchTermsDataSnapshot : public SearchTermsData { |
273 public: | 273 public: |
274 explicit SearchTermsDataSnapshot(const SearchTermsData& search_terms_data); | 274 explicit SearchTermsDataSnapshot(const SearchTermsData& search_terms_data); |
275 ~SearchTermsDataSnapshot() override; | 275 ~SearchTermsDataSnapshot() override; |
276 | 276 |
277 std::string GoogleBaseURLValue() const override; | 277 std::string GoogleBaseURLValue() const override; |
278 std::string GetApplicationLocale() const override; | 278 std::string GetApplicationLocale() const override; |
279 base::string16 GetRlzParameterValue(bool from_app_list) const override; | 279 base::string16 GetRlzParameterValue(bool from_app_list) const override; |
280 std::string GetSearchClient() const override; | 280 std::string GetSearchClient() const override; |
281 bool EnableAnswersInSuggest() const override; | |
282 bool IsShowingSearchTermsOnSearchResultsPages() const override; | 281 bool IsShowingSearchTermsOnSearchResultsPages() const override; |
283 std::string InstantExtendedEnabledParam(bool for_search) const override; | 282 std::string InstantExtendedEnabledParam(bool for_search) const override; |
284 std::string ForceInstantResultsParam(bool for_prerender) const override; | 283 std::string ForceInstantResultsParam(bool for_prerender) const override; |
285 std::string NTPIsThemedParam() const override; | 284 std::string NTPIsThemedParam() const override; |
286 std::string GoogleImageSearchSource() const override; | 285 std::string GoogleImageSearchSource() const override; |
287 | 286 |
288 private: | 287 private: |
289 std::string google_base_url_value_; | 288 std::string google_base_url_value_; |
290 std::string application_locale_; | 289 std::string application_locale_; |
291 base::string16 rlz_parameter_value_; | 290 base::string16 rlz_parameter_value_; |
292 std::string search_client_; | 291 std::string search_client_; |
293 bool enable_answers_in_suggest_; | |
294 bool is_showing_search_terms_on_search_results_pages_; | 292 bool is_showing_search_terms_on_search_results_pages_; |
295 std::string instant_extended_enabled_param_; | 293 std::string instant_extended_enabled_param_; |
296 std::string instant_extended_enabled_param_for_search_; | 294 std::string instant_extended_enabled_param_for_search_; |
297 std::string force_instant_results_param_; | 295 std::string force_instant_results_param_; |
298 std::string force_instant_results_param_for_prerender_; | 296 std::string force_instant_results_param_for_prerender_; |
299 std::string ntp_is_themed_param_; | 297 std::string ntp_is_themed_param_; |
300 std::string google_image_search_source_; | 298 std::string google_image_search_source_; |
301 | 299 |
302 DISALLOW_COPY_AND_ASSIGN(SearchTermsDataSnapshot); | 300 DISALLOW_COPY_AND_ASSIGN(SearchTermsDataSnapshot); |
303 }; | 301 }; |
304 | 302 |
305 SearchTermsDataSnapshot::SearchTermsDataSnapshot( | 303 SearchTermsDataSnapshot::SearchTermsDataSnapshot( |
306 const SearchTermsData& search_terms_data) | 304 const SearchTermsData& search_terms_data) |
307 : google_base_url_value_(search_terms_data.GoogleBaseURLValue()), | 305 : google_base_url_value_(search_terms_data.GoogleBaseURLValue()), |
308 application_locale_(search_terms_data.GetApplicationLocale()), | 306 application_locale_(search_terms_data.GetApplicationLocale()), |
309 rlz_parameter_value_(search_terms_data.GetRlzParameterValue(false)), | 307 rlz_parameter_value_(search_terms_data.GetRlzParameterValue(false)), |
310 search_client_(search_terms_data.GetSearchClient()), | 308 search_client_(search_terms_data.GetSearchClient()), |
311 enable_answers_in_suggest_(search_terms_data.EnableAnswersInSuggest()), | |
312 is_showing_search_terms_on_search_results_pages_( | 309 is_showing_search_terms_on_search_results_pages_( |
313 search_terms_data.IsShowingSearchTermsOnSearchResultsPages()), | 310 search_terms_data.IsShowingSearchTermsOnSearchResultsPages()), |
314 instant_extended_enabled_param_( | 311 instant_extended_enabled_param_( |
315 search_terms_data.InstantExtendedEnabledParam(false)), | 312 search_terms_data.InstantExtendedEnabledParam(false)), |
316 instant_extended_enabled_param_for_search_( | 313 instant_extended_enabled_param_for_search_( |
317 search_terms_data.InstantExtendedEnabledParam(true)), | 314 search_terms_data.InstantExtendedEnabledParam(true)), |
318 force_instant_results_param_( | 315 force_instant_results_param_( |
319 search_terms_data.ForceInstantResultsParam(false)), | 316 search_terms_data.ForceInstantResultsParam(false)), |
320 force_instant_results_param_for_prerender_( | 317 force_instant_results_param_for_prerender_( |
321 search_terms_data.ForceInstantResultsParam(true)), | 318 search_terms_data.ForceInstantResultsParam(true)), |
(...skipping 14 matching lines...) Expand all Loading... |
336 | 333 |
337 base::string16 SearchTermsDataSnapshot::GetRlzParameterValue( | 334 base::string16 SearchTermsDataSnapshot::GetRlzParameterValue( |
338 bool from_app_list) const { | 335 bool from_app_list) const { |
339 return rlz_parameter_value_; | 336 return rlz_parameter_value_; |
340 } | 337 } |
341 | 338 |
342 std::string SearchTermsDataSnapshot::GetSearchClient() const { | 339 std::string SearchTermsDataSnapshot::GetSearchClient() const { |
343 return search_client_; | 340 return search_client_; |
344 } | 341 } |
345 | 342 |
346 bool SearchTermsDataSnapshot::EnableAnswersInSuggest() const { | |
347 return enable_answers_in_suggest_; | |
348 } | |
349 | |
350 bool SearchTermsDataSnapshot::IsShowingSearchTermsOnSearchResultsPages() const { | 343 bool SearchTermsDataSnapshot::IsShowingSearchTermsOnSearchResultsPages() const { |
351 return is_showing_search_terms_on_search_results_pages_; | 344 return is_showing_search_terms_on_search_results_pages_; |
352 } | 345 } |
353 | 346 |
354 std::string SearchTermsDataSnapshot::InstantExtendedEnabledParam( | 347 std::string SearchTermsDataSnapshot::InstantExtendedEnabledParam( |
355 bool for_search) const { | 348 bool for_search) const { |
356 return for_search ? instant_extended_enabled_param_ : | 349 return for_search ? instant_extended_enabled_param_ : |
357 instant_extended_enabled_param_for_search_; | 350 instant_extended_enabled_param_for_search_; |
358 } | 351 } |
359 | 352 |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1202 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, | 1195 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, |
1203 match.contents.length(), ACMatchClassification::URL, | 1196 match.contents.length(), ACMatchClassification::URL, |
1204 &match.contents_class); | 1197 &match.contents_class); |
1205 } | 1198 } |
1206 match.description = info.title(); | 1199 match.description = info.title(); |
1207 match.description_class = | 1200 match.description_class = |
1208 ClassifyDescription(params.input.text(), match.description); | 1201 ClassifyDescription(params.input.text(), match.description); |
1209 RecordAdditionalInfoFromUrlRow(info, &match); | 1202 RecordAdditionalInfoFromUrlRow(info, &match); |
1210 return match; | 1203 return match; |
1211 } | 1204 } |
OLD | NEW |