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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_BOOKMARK_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_BOOKMARK_PROVIDER_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_BOOKMARK_PROVIDER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_BOOKMARK_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/autocomplete/autocomplete_input.h" | 10 #include "chrome/browser/autocomplete/autocomplete_input.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 virtual ~BookmarkProvider(); | 45 virtual ~BookmarkProvider(); |
46 | 46 |
47 // Performs the actual matching of |input| over the bookmarks and fills in | 47 // Performs the actual matching of |input| over the bookmarks and fills in |
48 // |matches_|. | 48 // |matches_|. |
49 void DoAutocomplete(const AutocompleteInput& input); | 49 void DoAutocomplete(const AutocompleteInput& input); |
50 | 50 |
51 // Compose an AutocompleteMatch based on |match| that has 1) the URL of | 51 // Compose an AutocompleteMatch based on |match| that has 1) the URL of |
52 // |match|'s bookmark, and 2) the bookmark's title, not the URL's page | 52 // |match|'s bookmark, and 2) the bookmark's title, not the URL's page |
53 // title, as the description. |input| is used to compute the match's | 53 // title, as the description. |input| is used to compute the match's |
54 // inline_autocompletion. |fixed_up_input| is used in that way as well; | 54 // inline_autocompletion. |fixed_up_input_text| is used in that way as well; |
55 // it's passed separately so this function doesn't have to compute it. | 55 // it's passed separately so this function doesn't have to compute it. |
56 AutocompleteMatch BookmarkMatchToACMatch( | 56 AutocompleteMatch BookmarkMatchToACMatch( |
57 const AutocompleteInput& input, | 57 const AutocompleteInput& input, |
58 const AutocompleteInput& fixed_up_input, | 58 const base::string16& fixed_up_input_text, |
59 const BookmarkMatch& match); | 59 const BookmarkMatch& match); |
60 | 60 |
61 // Converts |positions| into ACMatchClassifications and returns the | 61 // Converts |positions| into ACMatchClassifications and returns the |
62 // classifications. |text_length| is used to determine the need to add an | 62 // classifications. |text_length| is used to determine the need to add an |
63 // 'unhighlighted' classification span so the tail of the source string | 63 // 'unhighlighted' classification span so the tail of the source string |
64 // properly highlighted. | 64 // properly highlighted. |
65 static ACMatchClassifications ClassificationsFromMatch( | 65 static ACMatchClassifications ClassificationsFromMatch( |
66 const query_parser::Snippet::MatchPositions& positions, | 66 const query_parser::Snippet::MatchPositions& positions, |
67 size_t text_length, | 67 size_t text_length, |
68 bool is_url); | 68 bool is_url); |
69 | 69 |
70 BookmarkModel* bookmark_model_; | 70 BookmarkModel* bookmark_model_; |
71 | 71 |
72 // True if we should use matches in the URL for scoring. | 72 // True if we should use matches in the URL for scoring. |
73 const bool score_using_url_matches_; | 73 const bool score_using_url_matches_; |
74 | 74 |
75 // Languages used during the URL formatting. | 75 // Languages used during the URL formatting. |
76 std::string languages_; | 76 std::string languages_; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(BookmarkProvider); | 78 DISALLOW_COPY_AND_ASSIGN(BookmarkProvider); |
79 }; | 79 }; |
80 | 80 |
81 #endif // CHROME_BROWSER_AUTOCOMPLETE_BOOKMARK_PROVIDER_H_ | 81 #endif // CHROME_BROWSER_AUTOCOMPLETE_BOOKMARK_PROVIDER_H_ |
OLD | NEW |