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

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: Created 6 years, 9 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 13 matching lines...) Expand all
40 } 40 }
41 41
42 private: 42 private:
43 virtual ~BookmarkProvider(); 43 virtual ~BookmarkProvider();
44 44
45 // Performs the actual matching of |input| over the bookmarks and fills in 45 // Performs the actual matching of |input| over the bookmarks and fills in
46 // |matches_|. If |best_match| then only suggest the single best match, 46 // |matches_|. If |best_match| then only suggest the single best match,
47 // otherwise suggest the top |kMaxMatches| matches. 47 // otherwise suggest the top |kMaxMatches| matches.
48 void DoAutocomplete(const AutocompleteInput& input, bool best_match); 48 void DoAutocomplete(const AutocompleteInput& input, bool best_match);
49 49
50 // Compose an AutocompleteMatch based on |title_match| that has 1) the URL of 50 // Compose an AutocompleteMatch based on |match| that has 1) the URL of
51 // title_match's bookmark, and 2) the bookmark's title, not the URL's page 51 // title_match's bookmark, and 2) the bookmark's title, not the URL's page
52 // title, as the description. 52 // title, as the description.
53 AutocompleteMatch TitleMatchToACMatch(const BookmarkTitleMatch& title_match); 53 AutocompleteMatch BookmarkMatchToACMatch(const BookmarkMatch& match);
54 54
55 // Converts |positions| into ACMatchClassifications and returns the 55 // Converts |positions| into ACMatchClassifications and returns the
56 // classifications. |text_length| is used to determine the need to add an 56 // classifications. |text_length| is used to determine the need to add an
57 // 'unhighlighted' classification span so the tail of the source string 57 // 'unhighlighted' classification span so the tail of the source string
58 // properly highlighted. 58 // properly highlighted.
59 static ACMatchClassifications ClassificationsFromMatch( 59 static ACMatchClassifications ClassificationsFromMatch(
60 const Snippet::MatchPositions& positions, 60 const Snippet::MatchPositions& positions,
61 size_t text_length); 61 size_t text_length);
62 62
63 BookmarkModel* bookmark_model_; 63 BookmarkModel* bookmark_model_;
64 64
65 // Languages used during the URL formatting. 65 // Languages used during the URL formatting.
66 std::string languages_; 66 std::string languages_;
67 67
68 DISALLOW_COPY_AND_ASSIGN(BookmarkProvider); 68 DISALLOW_COPY_AND_ASSIGN(BookmarkProvider);
69 }; 69 };
70 70
71 #endif // CHROME_BROWSER_AUTOCOMPLETE_BOOKMARK_PROVIDER_H_ 71 #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/bookmarks/bookmark_match.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698