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

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

Issue 1841653003: Drop |languages| from {Format,Elide}Url* and IDNToUnicode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo in elide_url.cc Created 4 years, 8 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
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 #include <utility> 9 #include <utility>
10 10
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 if (loaded_) 140 if (loaded_)
141 return; 141 return;
142 142
143 // See comment in HistoryService::ShutdownOnUIThread where this is invoked for 143 // See comment in HistoryService::ShutdownOnUIThread where this is invoked for
144 // details. It is also called when the BookmarkModel is deleted. 144 // details. It is also called when the BookmarkModel is deleted.
145 loaded_signal_.Signal(); 145 loaded_signal_.Signal();
146 } 146 }
147 147
148 void BookmarkModel::Load( 148 void BookmarkModel::Load(
149 PrefService* pref_service, 149 PrefService* pref_service,
150 const std::string& accept_languages,
151 const base::FilePath& profile_path, 150 const base::FilePath& profile_path,
152 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, 151 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner,
153 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner) { 152 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner) {
154 if (store_.get()) { 153 if (store_.get()) {
155 // If the store is non-null, it means Load was already invoked. Load should 154 // If the store is non-null, it means Load was already invoked. Load should
156 // only be invoked once. 155 // only be invoked once.
157 NOTREACHED(); 156 NOTREACHED();
158 return; 157 return;
159 } 158 }
160 159
161 expanded_state_tracker_.reset( 160 expanded_state_tracker_.reset(
162 new BookmarkExpandedStateTracker(this, pref_service)); 161 new BookmarkExpandedStateTracker(this, pref_service));
163 162
164 // Load the bookmarks. BookmarkStorage notifies us when done. 163 // Load the bookmarks. BookmarkStorage notifies us when done.
165 store_.reset(new BookmarkStorage(this, profile_path, io_task_runner.get())); 164 store_.reset(new BookmarkStorage(this, profile_path, io_task_runner.get()));
166 store_->LoadBookmarks(CreateLoadDetails(accept_languages), ui_task_runner); 165 store_->LoadBookmarks(CreateLoadDetails(), ui_task_runner);
167 } 166 }
168 167
169 const BookmarkNode* BookmarkModel::GetParentForNewNodes() { 168 const BookmarkNode* BookmarkModel::GetParentForNewNodes() {
170 std::vector<const BookmarkNode*> nodes = 169 std::vector<const BookmarkNode*> nodes =
171 GetMostRecentlyModifiedUserFolders(this, 1); 170 GetMostRecentlyModifiedUserFolders(this, 1);
172 DCHECK(!nodes.empty()); // This list is always padded with default folders. 171 DCHECK(!nodes.empty()); // This list is always padded with default folders.
173 return nodes[0]; 172 return nodes[0];
174 } 173 }
175 174
176 void BookmarkModel::AddObserver(BookmarkModelObserver* observer) { 175 void BookmarkModel::AddObserver(BookmarkModelObserver* observer) {
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 if (node->is_url()) 1082 if (node->is_url())
1084 nodes_ordered_by_url_set_.insert(node); 1083 nodes_ordered_by_url_set_.insert(node);
1085 for (int i = 0; i < node->child_count(); ++i) 1084 for (int i = 0; i < node->child_count(); ++i)
1086 PopulateNodesByURL(node->GetChild(i)); 1085 PopulateNodesByURL(node->GetChild(i));
1087 } 1086 }
1088 1087
1089 int64_t BookmarkModel::generate_next_node_id() { 1088 int64_t BookmarkModel::generate_next_node_id() {
1090 return next_node_id_++; 1089 return next_node_id_++;
1091 } 1090 }
1092 1091
1093 scoped_ptr<BookmarkLoadDetails> BookmarkModel::CreateLoadDetails( 1092 scoped_ptr<BookmarkLoadDetails> BookmarkModel::CreateLoadDetails() {
1094 const std::string& accept_languages) {
1095 BookmarkPermanentNode* bb_node = 1093 BookmarkPermanentNode* bb_node =
1096 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); 1094 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR);
1097 BookmarkPermanentNode* other_node = 1095 BookmarkPermanentNode* other_node =
1098 CreatePermanentNode(BookmarkNode::OTHER_NODE); 1096 CreatePermanentNode(BookmarkNode::OTHER_NODE);
1099 BookmarkPermanentNode* mobile_node = 1097 BookmarkPermanentNode* mobile_node =
1100 CreatePermanentNode(BookmarkNode::MOBILE); 1098 CreatePermanentNode(BookmarkNode::MOBILE);
1101 return scoped_ptr<BookmarkLoadDetails>(new BookmarkLoadDetails( 1099 return scoped_ptr<BookmarkLoadDetails>(new BookmarkLoadDetails(
1102 bb_node, 1100 bb_node,
1103 other_node, 1101 other_node,
1104 mobile_node, 1102 mobile_node,
1105 client_->GetLoadExtraNodesCallback(), 1103 client_->GetLoadExtraNodesCallback(),
1106 new BookmarkIndex(client_.get(), accept_languages), 1104 new BookmarkIndex(client_.get()),
1107 next_node_id_)); 1105 next_node_id_));
1108 } 1106 }
1109 1107
1110 void BookmarkModel::SetUndoDelegate(BookmarkUndoDelegate* undo_delegate) { 1108 void BookmarkModel::SetUndoDelegate(BookmarkUndoDelegate* undo_delegate) {
1111 undo_delegate_ = undo_delegate; 1109 undo_delegate_ = undo_delegate;
1112 if (undo_delegate_) 1110 if (undo_delegate_)
1113 undo_delegate_->SetUndoProvider(this); 1111 undo_delegate_->SetUndoProvider(this);
1114 } 1112 }
1115 1113
1116 BookmarkUndoDelegate* BookmarkModel::undo_delegate() const { 1114 BookmarkUndoDelegate* BookmarkModel::undo_delegate() const {
1117 return undo_delegate_ ? undo_delegate_ : empty_undo_delegate_.get(); 1115 return undo_delegate_ ? undo_delegate_ : empty_undo_delegate_.get();
1118 } 1116 }
1119 1117
1120 } // namespace bookmarks 1118 } // namespace bookmarks
OLDNEW
« no previous file with comments | « components/bookmarks/browser/bookmark_model.h ('k') | components/bookmarks/browser/bookmark_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698