Index: chrome/browser/autocomplete/bookmark_provider.cc |
diff --git a/chrome/browser/autocomplete/bookmark_provider.cc b/chrome/browser/autocomplete/bookmark_provider.cc |
index 40a89e25ea71c31890efe4d9304b44fab3b808ef..e26c4e4747f8fe4cc41c02157f0e4ee03d9a2211 100644 |
--- a/chrome/browser/autocomplete/bookmark_provider.cc |
+++ b/chrome/browser/autocomplete/bookmark_provider.cc |
@@ -12,14 +12,14 @@ |
#include "base/prefs/pref_service.h" |
#include "base/time/time.h" |
#include "chrome/browser/autocomplete/autocomplete_result.h" |
+#include "chrome/browser/bookmarks/bookmark_match.h" |
#include "chrome/browser/bookmarks/bookmark_model.h" |
#include "chrome/browser/bookmarks/bookmark_model_factory.h" |
-#include "chrome/browser/bookmarks/bookmark_title_match.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/common/pref_names.h" |
#include "net/base/net_util.h" |
-typedef std::vector<BookmarkTitleMatch> TitleMatches; |
+typedef std::vector<BookmarkMatch> BookmarkMatches; |
// BookmarkProvider ------------------------------------------------------------ |
@@ -66,12 +66,12 @@ void BookmarkProvider::DoAutocomplete(const AutocompleteInput& input, |
if (!bookmark_model_) |
return; |
- TitleMatches matches; |
+ BookmarkMatches matches; |
// Retrieve enough bookmarks so that we have a reasonable probability of |
// suggesting the one that the user desires. |
const size_t kMaxBookmarkMatches = 50; |
- // GetBookmarksWithTitlesMatching returns bookmarks matching the user's |
+ // GetBookmarksMatching returns bookmarks matching the user's |
// search terms using the following rules: |
// - The search text is broken up into search terms. Each term is searched |
// for separately. |
@@ -86,24 +86,25 @@ void BookmarkProvider::DoAutocomplete(const AutocompleteInput& input, |
// - Multiple terms enclosed in quotes will require those exact words in that |
// exact order to match. |
// |
- // Note: GetBookmarksWithTitlesMatching() will never return a match span |
- // greater than the length of the title against which it is being matched, |
+ // *** REVISE THIS |
+ // Note: GetBookmarksMatching() will never return a match span greater than |
+ // the length of the title against which it is being matched, |
// nor can those spans ever overlap because the match spans are coalesced |
// for all matched terms. |
// |
- // Please refer to the code for BookmarkIndex::GetBookmarksWithTitlesMatching |
- // for complete details of how title searches are performed against the user's |
+ // Please refer to the code for BookmarkIndex::GetBookmarksMatching for |
+ // complete details of how title searches are performed against the user's |
// bookmarks. |
- bookmark_model_->GetBookmarksWithTitlesMatching(input.text(), |
- kMaxBookmarkMatches, |
- &matches); |
+ bookmark_model_->GetBookmarksMatching(input.text(), |
+ kMaxBookmarkMatches, |
+ &matches); |
if (matches.empty()) |
return; // There were no matches. |
- for (TitleMatches::const_iterator i = matches.begin(); i != matches.end(); |
+ for (BookmarkMatches::const_iterator i = matches.begin(); i != matches.end(); |
++i) { |
// Create and score the AutocompleteMatch. If its score is 0 then the |
// match is discarded. |
- AutocompleteMatch match(TitleMatchToACMatch(*i)); |
+ AutocompleteMatch match(BookmarkMatchToACMatch(*i)); |
if (match.relevance > 0) |
matches_.push_back(match); |
} |
@@ -157,8 +158,8 @@ class ScoringFunctor { |
} // namespace |
-AutocompleteMatch BookmarkProvider::TitleMatchToACMatch( |
- const BookmarkTitleMatch& title_match) { |
+AutocompleteMatch BookmarkProvider::BookmarkMatchToACMatch( |
+ const BookmarkMatch& title_match) { |
// The AutocompleteMatch we construct is non-deletable because the only |
// way to support this would be to delete the underlying bookmark, which is |
// unlikely to be what the user intends. |
@@ -178,12 +179,14 @@ AutocompleteMatch BookmarkProvider::TitleMatchToACMatch( |
match.contents); |
match.description = title; |
match.description_class = |
- ClassificationsFromMatch(title_match.match_positions, |
+ ClassificationsFromMatch(title_match.title_match_positions, |
match.description.size()); |
match.starred = true; |
// Summary on how a relevance score is determined for the match: |
// |
+ // *** REVISE THIS |
+ // |
// For each term matching within the bookmark's title (as given by the set of |
// Snippet::MatchPositions) calculate a 'factor', sum up those factors, then |
// use the sum to figure out a value between the base score and the maximum |
@@ -230,8 +233,9 @@ AutocompleteMatch BookmarkProvider::TitleMatchToACMatch( |
// given by |kURLCountBoost|, below. |
// |
ScoringFunctor position_functor = |
- for_each(title_match.match_positions.begin(), |
- title_match.match_positions.end(), ScoringFunctor(title.size())); |
+ for_each(title_match.title_match_positions.begin(), |
+ title_match.title_match_positions.end(), |
+ ScoringFunctor(title.size())); |
const int kBaseBookmarkScore = 900; |
const int kMaxBookmarkScore = AutocompleteResult::kLowestDefaultScore - 1; |
const double kBookmarkScoreRange = |