Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: chrome/browser/autocomplete/bookmark_provider.h

Issue 184663002: Omnibox: Make URLs of Bookmarks Searchable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tested; works Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "chrome/browser/autocomplete/autocomplete_match.h" 11 #include "chrome/browser/autocomplete/autocomplete_match.h"
12 #include "chrome/browser/autocomplete/autocomplete_provider.h" 12 #include "chrome/browser/autocomplete/autocomplete_provider.h"
13 #include "chrome/browser/history/snippet.h" 13 #include "chrome/browser/history/snippet.h"
14 14
15 class BookmarkModel; 15 class BookmarkModel;
16 struct BookmarkTitleMatch; 16 struct BookmarkMatch;
17 class Profile; 17 class Profile;
18 18
19 // This class is an autocomplete provider which quickly (and synchronously) 19 // This class is an autocomplete provider which quickly (and synchronously)
20 // provides autocomplete suggestions based on the titles of bookmarks. Page 20 // provides autocomplete suggestions based on the titles of bookmarks. Page
21 // titles, URLs, and typed and visit counts of the bookmarks are not currently 21 // titles, URLs, and typed and visit counts of the bookmarks are not currently
22 // taken into consideration as those factors will have been used by the 22 // taken into consideration as those factors will have been used by the
23 // HistoryQuickProvider (HQP) while identifying suggestions. 23 // HistoryQuickProvider (HQP) while identifying suggestions.
24 // 24 //
25 // TODO(mrossetti): Propose a way to coordinate with the HQP the taking of typed 25 // TODO(mrossetti): Propose a way to coordinate with the HQP the taking of typed
26 // and visit counts and last visit dates, etc. into consideration while scoring. 26 // and visit counts and last visit dates, etc. into consideration while scoring.
(...skipping 15 matching lines...) Expand all
42 private: 42 private:
43 FRIEND_TEST_ALL_PREFIXES(BookmarkProviderTest, InlineAutocompletion); 43 FRIEND_TEST_ALL_PREFIXES(BookmarkProviderTest, InlineAutocompletion);
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_|. If |best_match| then only suggest the single best match, 48 // |matches_|. If |best_match| then only suggest the single best match,
49 // otherwise suggest the top |kMaxMatches| matches. 49 // otherwise suggest the top |kMaxMatches| matches.
50 void DoAutocomplete(const AutocompleteInput& input, bool best_match); 50 void DoAutocomplete(const AutocompleteInput& input, bool best_match);
51 51
52 // Compose an AutocompleteMatch based on |title_match| that has 1) the URL of 52 // Compose an AutocompleteMatch based on |match| that has 1) the URL of
53 // title_match's bookmark, and 2) the bookmark's title, not the URL's page 53 // title_match's bookmark, and 2) the bookmark's title, not the URL's page
Peter Kasting 2014/04/16 23:44:25 Nit: This still refers to |title_match|
Mark P 2014/04/17 20:24:18 Done.
54 // title, as the description. |input| is used to compute the match's 54 // title, as the description. |input| is used to compute the match's
55 // inline_autocompletion. |fixed_up_input| is used in that way as well; 55 // inline_autocompletion. |fixed_up_input| is used in that way as well;
56 // it's passed separately so this function doesn't have to compute it. 56 // it's passed separately so this function doesn't have to compute it.
57 AutocompleteMatch TitleMatchToACMatch( 57 // title, as the description.
Peter Kasting 2014/04/16 23:44:25 Nit: Uh... broken edit?
Mark P 2014/04/17 20:24:18 Yup, bad rebase/resolve. Fixed.
58 AutocompleteMatch BookmarkMatchToACMatch(
58 const AutocompleteInput& input, 59 const AutocompleteInput& input,
59 const AutocompleteInput& fixed_up_input, 60 const AutocompleteInput& fixed_up_input,
60 const BookmarkTitleMatch& title_match); 61 const BookmarkMatch& match);
61 62
62 // Converts |positions| into ACMatchClassifications and returns the 63 // Converts |positions| into ACMatchClassifications and returns the
63 // classifications. |text_length| is used to determine the need to add an 64 // classifications. |text_length| is used to determine the need to add an
64 // 'unhighlighted' classification span so the tail of the source string 65 // 'unhighlighted' classification span so the tail of the source string
65 // properly highlighted. 66 // properly highlighted.
66 static ACMatchClassifications ClassificationsFromMatch( 67 static ACMatchClassifications ClassificationsFromMatch(
67 const Snippet::MatchPositions& positions, 68 const Snippet::MatchPositions& positions,
68 size_t text_length); 69 size_t text_length,
70 bool is_url);
69 71
70 BookmarkModel* bookmark_model_; 72 BookmarkModel* bookmark_model_;
71 73
74 // True if we should use matches in the URL for scoring.
75 const bool score_using_url_matches_;
76
72 // Languages used during the URL formatting. 77 // Languages used during the URL formatting.
73 std::string languages_; 78 std::string languages_;
74 79
75 DISALLOW_COPY_AND_ASSIGN(BookmarkProvider); 80 DISALLOW_COPY_AND_ASSIGN(BookmarkProvider);
76 }; 81 };
77 82
78 #endif // CHROME_BROWSER_AUTOCOMPLETE_BOOKMARK_PROVIDER_H_ 83 #endif // CHROME_BROWSER_AUTOCOMPLETE_BOOKMARK_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/bookmark_provider.cc » ('j') | chrome/browser/autocomplete/bookmark_provider.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698