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

Unified Diff: components/omnibox/browser/bookmark_provider.cc

Issue 2537223008: Add TitledUrlIndex for indexing arbitrary title/URL pairs (Closed)
Patch Set: fix bookmark_bridge Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: components/omnibox/browser/bookmark_provider.cc
diff --git a/components/omnibox/browser/bookmark_provider.cc b/components/omnibox/browser/bookmark_provider.cc
index 5068690db9765924cd2103e47448aa4ecc89011b..1976e8d0ade9c65b7a6bc2c2d99a60d96db3c991 100644
--- a/components/omnibox/browser/bookmark_provider.cc
+++ b/components/omnibox/browser/bookmark_provider.cc
@@ -24,10 +24,9 @@
#include "url/url_constants.h"
using bookmarks::BookmarkMatch;
+using BookmarkMatches = std::vector<BookmarkMatch>;
using bookmarks::BookmarkNode;
-typedef std::vector<BookmarkMatch> BookmarkMatches;
-
namespace {
// Removes leading spaces from |title| before displaying, otherwise it looks
@@ -165,11 +164,11 @@ AutocompleteMatch BookmarkProvider::BookmarkMatchToACMatch(
// unlikely to be what the user intends.
AutocompleteMatch match(this, 0, false,
AutocompleteMatchType::BOOKMARK_TITLE);
- base::string16 title(bookmark_match.node->GetTitle());
+ base::string16 title(bookmark_match.node->GetTitledUrlNodeTitle());
BookmarkMatch::MatchPositions new_title_match_positions =
bookmark_match.title_match_positions;
CorrectTitleAndMatchPositions(&title, &new_title_match_positions);
- const GURL& url(bookmark_match.node->url());
+ const GURL& url(bookmark_match.node->GetTitledUrlNodeUrl());
const base::string16& url_utf16 = base::UTF8ToUTF16(url.spec());
size_t inline_autocomplete_offset = URLPrefix::GetInlineAutocompleteOffset(
input.text(), fixed_up_input_text, false, url_utf16);
@@ -281,7 +280,8 @@ AutocompleteMatch BookmarkProvider::BookmarkMatchToACMatch(
ScoringFunctor url_position_functor =
for_each(bookmark_match.url_match_positions.begin(),
bookmark_match.url_match_positions.end(),
- ScoringFunctor(bookmark_match.node->url().spec().length()));
+ ScoringFunctor(
+ bookmark_match.node->GetTitledUrlNodeUrl().spec().length()));
const double title_match_strength = title_position_functor.ScoringFactor();
const double summed_factors = title_match_strength +
url_position_functor.ScoringFactor();

Powered by Google App Engine
This is Rietveld 408576698