| 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_quick_provider.h" | 5 #include "components/omnibox/browser/history_quick_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 history_match.url_matches.empty() ? | 193 history_match.url_matches.empty() ? |
| 194 AutocompleteMatchType::HISTORY_TITLE : | 194 AutocompleteMatchType::HISTORY_TITLE : |
| 195 AutocompleteMatchType::HISTORY_URL); | 195 AutocompleteMatchType::HISTORY_URL); |
| 196 match.typed_count = info.typed_count(); | 196 match.typed_count = info.typed_count(); |
| 197 match.destination_url = info.url(); | 197 match.destination_url = info.url(); |
| 198 DCHECK(match.destination_url.is_valid()); | 198 DCHECK(match.destination_url.is_valid()); |
| 199 size_t inline_autocomplete_offset = URLPrefix::GetInlineAutocompleteOffset( | 199 size_t inline_autocomplete_offset = URLPrefix::GetInlineAutocompleteOffset( |
| 200 autocomplete_input_.text(), FixupUserInput(autocomplete_input_).second, | 200 autocomplete_input_.text(), FixupUserInput(autocomplete_input_).second, |
| 201 false, base::UTF8ToUTF16(info.url().spec())); | 201 false, base::UTF8ToUTF16(info.url().spec())); |
| 202 | 202 |
| 203 // Format the URL autocomplete presentation. | |
| 204 const url_formatter::FormatUrlTypes format_types = | |
| 205 url_formatter::kFormatUrlOmitAll & | |
| 206 ~(!history_match.match_in_scheme ? 0 : url_formatter::kFormatUrlOmitHTTP); | |
| 207 base::OffsetAdjuster::Adjustments adjustments; | 203 base::OffsetAdjuster::Adjustments adjustments; |
| 208 match.contents = url_formatter::FormatUrlWithAdjustments( | 204 match.contents = |
| 209 info.url(), format_types, net::UnescapeRule::SPACES, nullptr, | 205 AutocompleteMatch::FormatUrlForSuggestionDisplayWithAdjustments( |
| 210 nullptr, &adjustments); | 206 info.url(), !history_match.match_in_scheme, &adjustments); |
| 211 match.fill_into_edit = | 207 match.fill_into_edit = |
| 212 AutocompleteInput::FormattedStringWithEquivalentMeaning( | 208 AutocompleteInput::FormattedStringWithEquivalentMeaning( |
| 213 info.url(), match.contents, client()->GetSchemeClassifier()); | 209 info.url(), match.contents, client()->GetSchemeClassifier()); |
| 214 std::vector<size_t> offsets = | 210 std::vector<size_t> offsets = |
| 215 OffsetsFromTermMatches(history_match.url_matches); | 211 OffsetsFromTermMatches(history_match.url_matches); |
| 216 // In addition to knowing how |offsets| is transformed, we need to know how | 212 // In addition to knowing how |offsets| is transformed, we need to know how |
| 217 // |inline_autocomplete_offset| is transformed. We add it to the end of | 213 // |inline_autocomplete_offset| is transformed. We add it to the end of |
| 218 // |offsets|, compute how everything is transformed, then remove it from the | 214 // |offsets|, compute how everything is transformed, then remove it from the |
| 219 // end. | 215 // end. |
| 220 offsets.push_back(inline_autocomplete_offset); | 216 offsets.push_back(inline_autocomplete_offset); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 246 match.description = info.title(); | 242 match.description = info.title(); |
| 247 match.description_class = SpansFromTermMatch( | 243 match.description_class = SpansFromTermMatch( |
| 248 history_match.title_matches, match.description.length(), false); | 244 history_match.title_matches, match.description.length(), false); |
| 249 | 245 |
| 250 match.RecordAdditionalInfo("typed count", info.typed_count()); | 246 match.RecordAdditionalInfo("typed count", info.typed_count()); |
| 251 match.RecordAdditionalInfo("visit count", info.visit_count()); | 247 match.RecordAdditionalInfo("visit count", info.visit_count()); |
| 252 match.RecordAdditionalInfo("last visit", info.last_visit()); | 248 match.RecordAdditionalInfo("last visit", info.last_visit()); |
| 253 | 249 |
| 254 return match; | 250 return match; |
| 255 } | 251 } |
| OLD | NEW |