OLD | NEW |
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_model.h" | 5 #include "chrome/browser/bookmarks/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" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/deferred_sequenced_task_runner.h" |
12 #include "base/json/json_string_value_serializer.h" | 13 #include "base/json/json_string_value_serializer.h" |
13 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
14 #include "base/string_util.h" | 15 #include "base/string_util.h" |
15 #include "base/values.h" | 16 #include "base/values.h" |
16 #include "build/build_config.h" | 17 #include "build/build_config.h" |
17 #include "chrome/browser/bookmarks/bookmark_expanded_state_tracker.h" | 18 #include "chrome/browser/bookmarks/bookmark_expanded_state_tracker.h" |
18 #include "chrome/browser/bookmarks/bookmark_index.h" | 19 #include "chrome/browser/bookmarks/bookmark_index.h" |
19 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | 20 #include "chrome/browser/bookmarks/bookmark_model_observer.h" |
20 #include "chrome/browser/bookmarks/bookmark_storage.h" | 21 #include "chrome/browser/bookmarks/bookmark_storage.h" |
21 #include "chrome/browser/bookmarks/bookmark_utils.h" | 22 #include "chrome/browser/bookmarks/bookmark_utils.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 244 |
244 expanded_state_tracker_.reset(new BookmarkExpandedStateTracker( | 245 expanded_state_tracker_.reset(new BookmarkExpandedStateTracker( |
245 profile_, this)); | 246 profile_, this)); |
246 | 247 |
247 // Listen for changes to favicons so that we can update the favicon of the | 248 // Listen for changes to favicons so that we can update the favicon of the |
248 // node appropriately. | 249 // node appropriately. |
249 registrar_.Add(this, chrome::NOTIFICATION_FAVICON_CHANGED, | 250 registrar_.Add(this, chrome::NOTIFICATION_FAVICON_CHANGED, |
250 content::Source<Profile>(profile_)); | 251 content::Source<Profile>(profile_)); |
251 | 252 |
252 // Load the bookmarks. BookmarkStorage notifies us when done. | 253 // Load the bookmarks. BookmarkStorage notifies us when done. |
253 store_ = new BookmarkStorage(profile_, this, profile_->GetIOTaskRunner()); | 254 store_ = new BookmarkStorage(profile_, |
| 255 this, |
| 256 profile_->GetBookmarksTaskRunner()); |
254 store_->LoadBookmarks(CreateLoadDetails()); | 257 store_->LoadBookmarks(CreateLoadDetails()); |
255 } | 258 } |
256 | 259 |
257 bool BookmarkModel::IsLoaded() const { | 260 bool BookmarkModel::IsLoaded() const { |
258 return loaded_; | 261 return loaded_; |
259 } | 262 } |
260 | 263 |
261 const BookmarkNode* BookmarkModel::GetParentForNewNodes() { | 264 const BookmarkNode* BookmarkModel::GetParentForNewNodes() { |
262 std::vector<const BookmarkNode*> nodes = | 265 std::vector<const BookmarkNode*> nodes = |
263 bookmark_utils::GetMostRecentlyModifiedFolders(this, 1); | 266 bookmark_utils::GetMostRecentlyModifiedFolders(this, 1); |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 BookmarkPermanentNode* bb_node = | 957 BookmarkPermanentNode* bb_node = |
955 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); | 958 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); |
956 BookmarkPermanentNode* other_node = | 959 BookmarkPermanentNode* other_node = |
957 CreatePermanentNode(BookmarkNode::OTHER_NODE); | 960 CreatePermanentNode(BookmarkNode::OTHER_NODE); |
958 BookmarkPermanentNode* mobile_node = | 961 BookmarkPermanentNode* mobile_node = |
959 CreatePermanentNode(BookmarkNode::MOBILE); | 962 CreatePermanentNode(BookmarkNode::MOBILE); |
960 return new BookmarkLoadDetails(bb_node, other_node, mobile_node, | 963 return new BookmarkLoadDetails(bb_node, other_node, mobile_node, |
961 new BookmarkIndex(profile_), | 964 new BookmarkIndex(profile_), |
962 next_node_id_); | 965 next_node_id_); |
963 } | 966 } |
OLD | NEW |