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

Side by Side Diff: components/bookmarks/browser/bookmark_model.cc

Issue 701553002: Allow systematic prefix search in bookmarks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/bookmarks/browser/bookmark_model.h" 5 #include "components/bookmarks/browser/bookmark_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 AsMutable(parent)->set_date_folder_modified(time); 682 AsMutable(parent)->set_date_folder_modified(time);
683 683
684 if (store_.get()) 684 if (store_.get())
685 store_->ScheduleSave(); 685 store_->ScheduleSave();
686 } 686 }
687 687
688 void BookmarkModel::ResetDateFolderModified(const BookmarkNode* node) { 688 void BookmarkModel::ResetDateFolderModified(const BookmarkNode* node) {
689 SetDateFolderModified(node, Time()); 689 SetDateFolderModified(node, Time());
690 } 690 }
691 691
692 void BookmarkModel::GetBookmarksMatching( 692 void BookmarkModel::GetBookmarksMatching(const base::string16& text,
693 size_t max_count,
694 std::vector<BookmarkMatch>* matches) {
695 if (!loaded_)
696 return;
697
698 index_->GetBookmarksMatching(
699 text, max_count, false /* always_prefix_search */, matches);
700 }
701
702 void BookmarkModel::GetBookmarksMatchingPrefixes(
693 const base::string16& text, 703 const base::string16& text,
694 size_t max_count, 704 size_t max_count,
695 std::vector<BookmarkMatch>* matches) { 705 std::vector<BookmarkMatch>* matches) {
696 if (!loaded_) 706 if (!loaded_)
697 return; 707 return;
698 708
699 index_->GetBookmarksMatching(text, max_count, matches); 709 index_->GetBookmarksMatching(
710 text, max_count, true /* always_prefix_search */, matches);
sky 2014/11/03 21:44:05 I'm not a fan of this style. It's a good indicatio
Kibeom Kim (inactive) 2014/11/04 01:28:19 Done.
700 } 711 }
701 712
702 void BookmarkModel::ClearStore() { 713 void BookmarkModel::ClearStore() {
703 store_.reset(); 714 store_.reset();
704 } 715 }
705 716
706 void BookmarkModel::SetPermanentNodeVisible(BookmarkNode::Type type, 717 void BookmarkModel::SetPermanentNodeVisible(BookmarkNode::Type type,
707 bool value) { 718 bool value) {
708 BookmarkPermanentNode* node = AsMutable(PermanentNode(type)); 719 BookmarkPermanentNode* node = AsMutable(PermanentNode(type));
709 node->set_visible(value || client_->IsPermanentNodeVisible(node)); 720 node->set_visible(value || client_->IsPermanentNodeVisible(node));
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 BookmarkPermanentNode* mobile_node = 1015 BookmarkPermanentNode* mobile_node =
1005 CreatePermanentNode(BookmarkNode::MOBILE); 1016 CreatePermanentNode(BookmarkNode::MOBILE);
1006 return scoped_ptr<BookmarkLoadDetails>(new BookmarkLoadDetails( 1017 return scoped_ptr<BookmarkLoadDetails>(new BookmarkLoadDetails(
1007 bb_node, 1018 bb_node,
1008 other_node, 1019 other_node,
1009 mobile_node, 1020 mobile_node,
1010 client_->GetLoadExtraNodesCallback(), 1021 client_->GetLoadExtraNodesCallback(),
1011 new BookmarkIndex(client_, accept_languages), 1022 new BookmarkIndex(client_, accept_languages),
1012 next_node_id_)); 1023 next_node_id_));
1013 } 1024 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698