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 "chrome/browser/autocomplete/history_url_provider.h" | 5 #include "chrome/browser/autocomplete/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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 // member strings, then returning those strings when its own getters are called. | 230 // member strings, then returning those strings when its own getters are called. |
231 // This will typically be constructed on the UI thread from | 231 // This will typically be constructed on the UI thread from |
232 // UIThreadSearchTermsData but is subsequently safe to use on any thread. | 232 // UIThreadSearchTermsData but is subsequently safe to use on any thread. |
233 class SearchTermsDataSnapshot : public SearchTermsData { | 233 class SearchTermsDataSnapshot : public SearchTermsData { |
234 public: | 234 public: |
235 explicit SearchTermsDataSnapshot(const SearchTermsData& search_terms_data); | 235 explicit SearchTermsDataSnapshot(const SearchTermsData& search_terms_data); |
236 virtual ~SearchTermsDataSnapshot(); | 236 virtual ~SearchTermsDataSnapshot(); |
237 | 237 |
238 virtual std::string GoogleBaseURLValue() const OVERRIDE; | 238 virtual std::string GoogleBaseURLValue() const OVERRIDE; |
239 virtual std::string GetApplicationLocale() const OVERRIDE; | 239 virtual std::string GetApplicationLocale() const OVERRIDE; |
240 virtual base::string16 GetRlzParameterValue() const OVERRIDE; | 240 virtual base::string16 GetRlzParameterValue( |
| 241 bool from_app_list) const OVERRIDE; |
241 virtual std::string GetSearchClient() const OVERRIDE; | 242 virtual std::string GetSearchClient() const OVERRIDE; |
242 virtual std::string NTPIsThemedParam() const OVERRIDE; | 243 virtual std::string NTPIsThemedParam() const OVERRIDE; |
243 | 244 |
244 private: | 245 private: |
245 std::string google_base_url_value_; | 246 std::string google_base_url_value_; |
246 std::string application_locale_; | 247 std::string application_locale_; |
247 base::string16 rlz_parameter_value_; | 248 base::string16 rlz_parameter_value_; |
248 std::string search_client_; | 249 std::string search_client_; |
249 std::string ntp_is_themed_param_; | 250 std::string ntp_is_themed_param_; |
250 | 251 |
251 DISALLOW_COPY_AND_ASSIGN(SearchTermsDataSnapshot); | 252 DISALLOW_COPY_AND_ASSIGN(SearchTermsDataSnapshot); |
252 }; | 253 }; |
253 | 254 |
254 SearchTermsDataSnapshot::SearchTermsDataSnapshot( | 255 SearchTermsDataSnapshot::SearchTermsDataSnapshot( |
255 const SearchTermsData& search_terms_data) | 256 const SearchTermsData& search_terms_data) |
256 : google_base_url_value_(search_terms_data.GoogleBaseURLValue()), | 257 : google_base_url_value_(search_terms_data.GoogleBaseURLValue()), |
257 application_locale_(search_terms_data.GetApplicationLocale()), | 258 application_locale_(search_terms_data.GetApplicationLocale()), |
258 rlz_parameter_value_(search_terms_data.GetRlzParameterValue()), | 259 rlz_parameter_value_(search_terms_data.GetRlzParameterValue(false)), |
259 search_client_(search_terms_data.GetSearchClient()), | 260 search_client_(search_terms_data.GetSearchClient()), |
260 ntp_is_themed_param_(search_terms_data.NTPIsThemedParam()) {} | 261 ntp_is_themed_param_(search_terms_data.NTPIsThemedParam()) {} |
261 | 262 |
262 SearchTermsDataSnapshot::~SearchTermsDataSnapshot() { | 263 SearchTermsDataSnapshot::~SearchTermsDataSnapshot() { |
263 } | 264 } |
264 | 265 |
265 std::string SearchTermsDataSnapshot::GoogleBaseURLValue() const { | 266 std::string SearchTermsDataSnapshot::GoogleBaseURLValue() const { |
266 return google_base_url_value_; | 267 return google_base_url_value_; |
267 } | 268 } |
268 | 269 |
269 std::string SearchTermsDataSnapshot::GetApplicationLocale() const { | 270 std::string SearchTermsDataSnapshot::GetApplicationLocale() const { |
270 return application_locale_; | 271 return application_locale_; |
271 } | 272 } |
272 | 273 |
273 base::string16 SearchTermsDataSnapshot::GetRlzParameterValue() const { | 274 base::string16 SearchTermsDataSnapshot::GetRlzParameterValue( |
| 275 bool from_app_list) const { |
274 return rlz_parameter_value_; | 276 return rlz_parameter_value_; |
275 } | 277 } |
276 | 278 |
277 std::string SearchTermsDataSnapshot::GetSearchClient() const { | 279 std::string SearchTermsDataSnapshot::GetSearchClient() const { |
278 return search_client_; | 280 return search_client_; |
279 } | 281 } |
280 | 282 |
281 std::string SearchTermsDataSnapshot::NTPIsThemedParam() const { | 283 std::string SearchTermsDataSnapshot::NTPIsThemedParam() const { |
282 return ntp_is_themed_param_; | 284 return ntp_is_themed_param_; |
283 } | 285 } |
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 history::MatchTermInString(input_text, clean_description, 0))); | 1156 history::MatchTermInString(input_text, clean_description, 0))); |
1155 history::WordStarts description_word_starts; | 1157 history::WordStarts description_word_starts; |
1156 history::String16VectorFromString16( | 1158 history::String16VectorFromString16( |
1157 clean_description, false, &description_word_starts); | 1159 clean_description, false, &description_word_starts); |
1158 description_matches = | 1160 description_matches = |
1159 history::ScoredHistoryMatch::FilterTermMatchesByWordStarts( | 1161 history::ScoredHistoryMatch::FilterTermMatchesByWordStarts( |
1160 description_matches, description_word_starts, 0, std::string::npos); | 1162 description_matches, description_word_starts, 0, std::string::npos); |
1161 return SpansFromTermMatch( | 1163 return SpansFromTermMatch( |
1162 description_matches, clean_description.length(), false); | 1164 description_matches, clean_description.length(), false); |
1163 } | 1165 } |
OLD | NEW |