| Index: components/bookmarks/browser/titled_url_match.cc
|
| diff --git a/components/bookmarks/browser/titled_url_match.cc b/components/bookmarks/browser/titled_url_match.cc
|
| index 313ae4ef17704659e8cc8fa45a64447a4202bf14..a062f4e5a56165413a634c47cd86e2848910b34b 100644
|
| --- a/components/bookmarks/browser/titled_url_match.cc
|
| +++ b/components/bookmarks/browser/titled_url_match.cc
|
| @@ -5,7 +5,7 @@
|
| #include "components/bookmarks/browser/titled_url_match.h"
|
|
|
| #include "base/logging.h"
|
| -#include "base/strings/string16.h"
|
| +#include "base/strings/string_util.h"
|
|
|
| namespace bookmarks {
|
|
|
| @@ -47,4 +47,20 @@ TitledUrlMatch::MatchPositions TitledUrlMatch::ReplaceOffsetsInMatchPositions(
|
| return new_match_positions;
|
| }
|
|
|
| +// static
|
| +void TitledUrlMatch::CorrectTitleAndMatchPositions(
|
| + base::string16* title,
|
| + MatchPositions* title_match_positions) {
|
| + size_t leading_whitespace_chars = title->length();
|
| + base::TrimWhitespace(*title, base::TRIM_LEADING, title);
|
| + leading_whitespace_chars -= title->length();
|
| + if (leading_whitespace_chars == 0)
|
| + return;
|
| + for (MatchPositions::iterator it = title_match_positions->begin();
|
| + it != title_match_positions->end(); ++it) {
|
| + it->first -= leading_whitespace_chars;
|
| + it->second -= leading_whitespace_chars;
|
| + }
|
| +}
|
| +
|
| } // namespace bookmarks
|
|
|