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_quick_provider.h" | 5 #include "chrome/browser/autocomplete/history_quick_provider.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/debug/crash_logging.h" | 11 #include "base/debug/crash_logging.h" |
12 #include "base/i18n/break_iterator.h" | 12 #include "base/i18n/break_iterator.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/metrics/field_trial.h" | 14 #include "base/metrics/field_trial.h" |
15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/string_split.h" | |
17 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
18 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
19 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" | 20 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |
20 #include "chrome/browser/autocomplete/history_url_provider.h" | 21 #include "chrome/browser/autocomplete/history_url_provider.h" |
21 #include "chrome/browser/autocomplete/in_memory_url_index.h" | 22 #include "chrome/browser/autocomplete/in_memory_url_index.h" |
22 #include "chrome/browser/autocomplete/in_memory_url_index_types.h" | 23 #include "chrome/browser/autocomplete/in_memory_url_index_types.h" |
23 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 24 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
24 #include "chrome/browser/history/history_service_factory.h" | 25 #include "chrome/browser/history/history_service_factory.h" |
25 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
26 #include "chrome/browser/search_engines/template_url_service_factory.h" | 27 #include "chrome/browser/search_engines/template_url_service_factory.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
262 // |fill_into_edit| if the user has typed an URL with a scheme and the | 263 // |fill_into_edit| if the user has typed an URL with a scheme and the |
263 // last character typed is a slash. That slash is removed by the | 264 // last character typed is a slash. That slash is removed by the |
264 // FormatURLWithOffsets call above. | 265 // FormatURLWithOffsets call above. |
265 if (inline_autocomplete_offset < match.fill_into_edit.length()) { | 266 if (inline_autocomplete_offset < match.fill_into_edit.length()) { |
266 match.inline_autocompletion = | 267 match.inline_autocompletion = |
267 match.fill_into_edit.substr(inline_autocomplete_offset); | 268 match.fill_into_edit.substr(inline_autocomplete_offset); |
268 } | 269 } |
269 match.allowed_to_be_default_match = match.inline_autocompletion.empty() || | 270 match.allowed_to_be_default_match = match.inline_autocompletion.empty() || |
270 !PreventInlineAutocomplete(autocomplete_input_); | 271 !PreventInlineAutocomplete(autocomplete_input_); |
271 } | 272 } |
273 std::vector<base::string16> words; | |
274 base::SplitString(autocomplete_input_.text(), ' ', &words); | |
Peter Kasting
2015/06/01 21:04:08
I'm concerned about all these files doing a manual
Mark P
2015/06/01 22:05:50
I would think any decent break iterator would spli
Peter Kasting
2015/06/01 22:21:58
Fair enough.
Mark P
2015/06/04 23:31:31
Done. Let me know what you think.
| |
272 match.EnsureUWYTIsAllowedToBeDefault( | 275 match.EnsureUWYTIsAllowedToBeDefault( |
273 autocomplete_input_.canonicalized_url(), | 276 autocomplete_input_.canonicalized_url(), |
277 words, | |
274 TemplateURLServiceFactory::GetForProfile(profile_)); | 278 TemplateURLServiceFactory::GetForProfile(profile_)); |
275 | 279 |
276 // Format the description autocomplete presentation. | 280 // Format the description autocomplete presentation. |
277 match.description = info.title(); | 281 match.description = info.title(); |
278 match.description_class = SpansFromTermMatch( | 282 match.description_class = SpansFromTermMatch( |
279 history_match.title_matches, match.description.length(), false); | 283 history_match.title_matches, match.description.length(), false); |
280 | 284 |
281 match.RecordAdditionalInfo("typed count", info.typed_count()); | 285 match.RecordAdditionalInfo("typed count", info.typed_count()); |
282 match.RecordAdditionalInfo("visit count", info.visit_count()); | 286 match.RecordAdditionalInfo("visit count", info.visit_count()); |
283 match.RecordAdditionalInfo("last visit", info.last_visit()); | 287 match.RecordAdditionalInfo("last visit", info.last_visit()); |
284 | 288 |
285 return match; | 289 return match; |
286 } | 290 } |
OLD | NEW |