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" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 } | 186 } |
187 } | 187 } |
188 | 188 |
189 AutocompleteMatch HistoryQuickProvider::QuickMatchToACMatch( | 189 AutocompleteMatch HistoryQuickProvider::QuickMatchToACMatch( |
190 const ScoredHistoryMatch& history_match, | 190 const ScoredHistoryMatch& history_match, |
191 int score) { | 191 int score) { |
192 const history::URLRow& info = history_match.url_info; | 192 const history::URLRow& info = history_match.url_info; |
193 AutocompleteMatch match(this, score, !!info.visit_count(), | 193 AutocompleteMatch match(this, score, !!info.visit_count(), |
194 history_match.url_matches.empty() ? | 194 history_match.url_matches.empty() ? |
195 AutocompleteMatch::HISTORY_TITLE : AutocompleteMatch::HISTORY_URL); | 195 AutocompleteMatch::HISTORY_TITLE : AutocompleteMatch::HISTORY_URL); |
| 196 match.typed_count = info.typed_count(); |
196 match.destination_url = info.url(); | 197 match.destination_url = info.url(); |
197 DCHECK(match.destination_url.is_valid()); | 198 DCHECK(match.destination_url.is_valid()); |
198 | 199 |
199 // Format the URL autocomplete presentation. | 200 // Format the URL autocomplete presentation. |
200 std::vector<size_t> offsets = | 201 std::vector<size_t> offsets = |
201 OffsetsFromTermMatches(history_match.url_matches); | 202 OffsetsFromTermMatches(history_match.url_matches); |
202 const net::FormatUrlTypes format_types = net::kFormatUrlOmitAll & | 203 const net::FormatUrlTypes format_types = net::kFormatUrlOmitAll & |
203 ~(!history_match.match_in_scheme ? 0 : net::kFormatUrlOmitHTTP); | 204 ~(!history_match.match_in_scheme ? 0 : net::kFormatUrlOmitHTTP); |
204 match.fill_into_edit = | 205 match.fill_into_edit = |
205 AutocompleteInput::FormattedStringWithEquivalentMeaning(info.url(), | 206 AutocompleteInput::FormattedStringWithEquivalentMeaning(info.url(), |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 do { | 270 do { |
270 offset += matches[i].length; | 271 offset += matches[i].length; |
271 ++i; | 272 ++i; |
272 } while ((i < match_count) && (offset == matches[i].offset)); | 273 } while ((i < match_count) && (offset == matches[i].offset)); |
273 if (offset < text_length) | 274 if (offset < text_length) |
274 spans.push_back(ACMatchClassification(offset, url_style)); | 275 spans.push_back(ACMatchClassification(offset, url_style)); |
275 } | 276 } |
276 | 277 |
277 return spans; | 278 return spans; |
278 } | 279 } |
OLD | NEW |