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 |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" | 14 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |
15 #include "chrome/browser/autocomplete/history_provider.h" | 15 #include "chrome/browser/autocomplete/history_provider.h" |
16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
19 #include "components/bookmarks/browser/bookmark_match.h" | 19 #include "components/bookmarks/browser/bookmark_match.h" |
20 #include "components/bookmarks/browser/bookmark_model.h" | 20 #include "components/bookmarks/browser/bookmark_model.h" |
21 #include "components/metrics/proto/omnibox_input_type.pb.h" | 21 #include "components/metrics/proto/omnibox_input_type.pb.h" |
22 #include "components/omnibox/autocomplete_result.h" | 22 #include "components/omnibox/autocomplete_result.h" |
23 #include "components/omnibox/url_prefix.h" | 23 #include "components/omnibox/url_prefix.h" |
24 #include "net/base/net_util.h" | 24 #include "net/base/net_util.h" |
25 #include "url/url_constants.h" | 25 #include "url/url_constants.h" |
26 | 26 |
27 using bookmarks::BookmarkMatch; | 27 using bookmarks::BookmarkMatch; |
| 28 using bookmarks::BookmarkNode; |
28 | 29 |
29 typedef std::vector<BookmarkMatch> BookmarkMatches; | 30 typedef std::vector<BookmarkMatch> BookmarkMatches; |
30 | 31 |
31 namespace { | 32 namespace { |
32 | 33 |
33 // Removes leading spaces from |title| before displaying, otherwise it looks | 34 // Removes leading spaces from |title| before displaying, otherwise it looks |
34 // funny. In the process, corrects |title_match_positions| so the correct | 35 // funny. In the process, corrects |title_match_positions| so the correct |
35 // characters are highlighted. | 36 // characters are highlighted. |
36 void CorrectTitleAndMatchPositions( | 37 void CorrectTitleAndMatchPositions( |
37 base::string16* title, | 38 base::string16* title, |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 i != positions.end(); | 339 i != positions.end(); |
339 ++i) { | 340 ++i) { |
340 AutocompleteMatch::ACMatchClassifications new_class; | 341 AutocompleteMatch::ACMatchClassifications new_class; |
341 AutocompleteMatch::ClassifyLocationInString(i->first, i->second - i->first, | 342 AutocompleteMatch::ClassifyLocationInString(i->first, i->second - i->first, |
342 text_length, url_style, &new_class); | 343 text_length, url_style, &new_class); |
343 classifications = AutocompleteMatch::MergeClassifications( | 344 classifications = AutocompleteMatch::MergeClassifications( |
344 classifications, new_class); | 345 classifications, new_class); |
345 } | 346 } |
346 return classifications; | 347 return classifications; |
347 } | 348 } |
OLD | NEW |