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/bookmark_provider.h" | 5 #include "chrome/browser/autocomplete/bookmark_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 } // namespace | 158 } // namespace |
159 | 159 |
160 AutocompleteMatch BookmarkProvider::TitleMatchToACMatch( | 160 AutocompleteMatch BookmarkProvider::TitleMatchToACMatch( |
161 const BookmarkTitleMatch& title_match) { | 161 const BookmarkTitleMatch& title_match) { |
162 // The AutocompleteMatch we construct is non-deletable because the only | 162 // The AutocompleteMatch we construct is non-deletable because the only |
163 // way to support this would be to delete the underlying bookmark, which is | 163 // way to support this would be to delete the underlying bookmark, which is |
164 // unlikely to be what the user intends. | 164 // unlikely to be what the user intends. |
165 AutocompleteMatch match(this, 0, false, | 165 AutocompleteMatch match(this, 0, false, |
166 AutocompleteMatchType::BOOKMARK_TITLE); | 166 AutocompleteMatchType::BOOKMARK_TITLE); |
167 const string16& title(title_match.node->GetTitle()); | 167 const base::string16& title(title_match.node->GetTitle()); |
168 DCHECK(!title.empty()); | 168 DCHECK(!title.empty()); |
169 const GURL& url(title_match.node->url()); | 169 const GURL& url(title_match.node->url()); |
170 match.destination_url = url; | 170 match.destination_url = url; |
171 match.contents = net::FormatUrl(url, languages_, | 171 match.contents = net::FormatUrl(url, languages_, |
172 net::kFormatUrlOmitAll & net::kFormatUrlOmitHTTP, | 172 net::kFormatUrlOmitAll & net::kFormatUrlOmitHTTP, |
173 net::UnescapeRule::SPACES, NULL, NULL, NULL); | 173 net::UnescapeRule::SPACES, NULL, NULL, NULL); |
174 match.contents_class.push_back( | 174 match.contents_class.push_back( |
175 ACMatchClassification(0, ACMatchClassification::NONE)); | 175 ACMatchClassification(0, ACMatchClassification::NONE)); |
176 match.fill_into_edit = | 176 match.fill_into_edit = |
177 AutocompleteInput::FormattedStringWithEquivalentMeaning(url, | 177 AutocompleteInput::FormattedStringWithEquivalentMeaning(url, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 for (Snippet::MatchPositions::const_iterator i = positions.begin(); | 270 for (Snippet::MatchPositions::const_iterator i = positions.begin(); |
271 i != positions.end(); ++i) { | 271 i != positions.end(); ++i) { |
272 AutocompleteMatch::ACMatchClassifications new_class; | 272 AutocompleteMatch::ACMatchClassifications new_class; |
273 AutocompleteMatch::ClassifyLocationInString(i->first, i->second - i->first, | 273 AutocompleteMatch::ClassifyLocationInString(i->first, i->second - i->first, |
274 text_length, 0, &new_class); | 274 text_length, 0, &new_class); |
275 classifications = AutocompleteMatch::MergeClassifications( | 275 classifications = AutocompleteMatch::MergeClassifications( |
276 classifications, new_class); | 276 classifications, new_class); |
277 } | 277 } |
278 return classifications; | 278 return classifications; |
279 } | 279 } |
OLD | NEW |