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

Side by Side Diff: chrome/browser/bookmarks/bookmark_utils.cc

Issue 255423002: Omnibox: Highlight Matches in URLs Properly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix OffsetsFromTermMatches test Created 6 years, 7 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 #include "chrome/browser/bookmarks/bookmark_utils.h" 5 #include "chrome/browser/bookmarks/bookmark_utils.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 399
400 // Remove all the bookmarks. 400 // Remove all the bookmarks.
401 for (size_t i = 0; i < bookmarks.size(); ++i) { 401 for (size_t i = 0; i < bookmarks.size(); ++i) {
402 const BookmarkNode* node = bookmarks[i]; 402 const BookmarkNode* node = bookmarks[i];
403 int index = node->parent()->GetIndexOf(node); 403 int index = node->parent()->GetIndexOf(node);
404 if (index > -1) 404 if (index > -1)
405 model->Remove(node->parent(), index); 405 model->Remove(node->parent(), index);
406 } 406 }
407 } 407 }
408 408
409 base::string16 CleanUpUrlForMatching(const GURL& gurl, 409 base::string16 CleanUpUrlForMatching(
410 const std::string& languages) { 410 const GURL& gurl,
411 return base::i18n::ToLower(net::FormatUrl( 411 const std::string& languages,
412 base::OffsetAdjuster::Adjustments* adjustments) {
413 base::OffsetAdjuster::Adjustments tmp_adjustments;
414 return base::i18n::ToLower(net::FormatUrlWithAdjustments(
412 GURL(TruncateUrl(gurl.spec())), languages, 415 GURL(TruncateUrl(gurl.spec())), languages,
413 net::kFormatUrlOmitUsernamePassword, 416 net::kFormatUrlOmitUsernamePassword,
414 net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS, 417 net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS,
415 NULL, NULL, NULL)); 418 NULL, NULL, adjustments ? adjustments : &tmp_adjustments));
416 } 419 }
417 420
418 base::string16 CleanUpTitleForMatching(const base::string16& title) { 421 base::string16 CleanUpTitleForMatching(const base::string16& title) {
419 return base::i18n::ToLower(title.substr(0u, kCleanedUpTitleMaxLength)); 422 return base::i18n::ToLower(title.substr(0u, kCleanedUpTitleMaxLength));
420 } 423 }
421 424
422 } // namespace bookmark_utils 425 } // namespace bookmark_utils
423 426
424 const BookmarkNode* GetBookmarkNodeByID(const BookmarkModel* model, int64 id) { 427 const BookmarkNode* GetBookmarkNodeByID(const BookmarkModel* model, int64 id) {
425 // TODO(sky): TreeNode needs a method that visits all nodes using a predicate. 428 // TODO(sky): TreeNode needs a method that visits all nodes using a predicate.
426 return GetNodeByID(model->root_node(), id); 429 return GetNodeByID(model->root_node(), id);
427 } 430 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_utils.h ('k') | chrome/browser/history/in_memory_url_index_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698