| 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/i18n/string_compare.h" | 12 #include "base/i18n/string_compare.h" |
| 13 #include "base/json/json_string_value_serializer.h" | 13 #include "base/json/json_string_value_serializer.h" |
| 14 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "build/build_config.h" | |
| 19 #include "chrome/browser/bookmarks/bookmark_expanded_state_tracker.h" | 18 #include "chrome/browser/bookmarks/bookmark_expanded_state_tracker.h" |
| 20 #include "chrome/browser/bookmarks/bookmark_index.h" | 19 #include "chrome/browser/bookmarks/bookmark_index.h" |
| 21 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | 20 #include "chrome/browser/bookmarks/bookmark_model_observer.h" |
| 22 #include "chrome/browser/bookmarks/bookmark_storage.h" | 21 #include "chrome/browser/bookmarks/bookmark_storage.h" |
| 23 #include "chrome/browser/bookmarks/bookmark_title_match.h" | 22 #include "chrome/browser/bookmarks/bookmark_title_match.h" |
| 24 #include "chrome/browser/bookmarks/bookmark_utils.h" | 23 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 25 #include "chrome/browser/favicon/favicon_changed_details.h" | 24 #include "chrome/browser/favicon/favicon_changed_details.h" |
| 26 #include "chrome/browser/favicon/favicon_service.h" | 25 #include "chrome/browser/favicon/favicon_service.h" |
| 27 #include "chrome/browser/favicon/favicon_service_factory.h" | 26 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 28 #include "chrome/browser/favicon/favicon_types.h" | 27 #include "chrome/browser/favicon/favicon_types.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 | 254 |
| 256 void BookmarkModel::Load( | 255 void BookmarkModel::Load( |
| 257 const scoped_refptr<base::SequencedTaskRunner>& task_runner) { | 256 const scoped_refptr<base::SequencedTaskRunner>& task_runner) { |
| 258 if (store_.get()) { | 257 if (store_.get()) { |
| 259 // If the store is non-null, it means Load was already invoked. Load should | 258 // If the store is non-null, it means Load was already invoked. Load should |
| 260 // only be invoked once. | 259 // only be invoked once. |
| 261 NOTREACHED(); | 260 NOTREACHED(); |
| 262 return; | 261 return; |
| 263 } | 262 } |
| 264 | 263 |
| 265 expanded_state_tracker_.reset(new BookmarkExpandedStateTracker( | 264 expanded_state_tracker_.reset( |
| 266 profile_, this)); | 265 new BookmarkExpandedStateTracker(this, profile_->GetPrefs())); |
| 267 | 266 |
| 268 // Listen for changes to favicons so that we can update the favicon of the | 267 // Listen for changes to favicons so that we can update the favicon of the |
| 269 // node appropriately. | 268 // node appropriately. |
| 270 registrar_.Add(this, chrome::NOTIFICATION_FAVICON_CHANGED, | 269 registrar_.Add(this, chrome::NOTIFICATION_FAVICON_CHANGED, |
| 271 content::Source<Profile>(profile_)); | 270 content::Source<Profile>(profile_)); |
| 272 | 271 |
| 273 // Load the bookmarks. BookmarkStorage notifies us when done. | 272 // Load the bookmarks. BookmarkStorage notifies us when done. |
| 274 store_ = new BookmarkStorage(profile_, this, task_runner.get()); | 273 store_ = new BookmarkStorage(profile_, this, task_runner.get()); |
| 275 store_->LoadBookmarks(CreateLoadDetails()); | 274 store_->LoadBookmarks(CreateLoadDetails()); |
| 276 } | 275 } |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 BookmarkPermanentNode* bb_node = | 1048 BookmarkPermanentNode* bb_node = |
| 1050 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); | 1049 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); |
| 1051 BookmarkPermanentNode* other_node = | 1050 BookmarkPermanentNode* other_node = |
| 1052 CreatePermanentNode(BookmarkNode::OTHER_NODE); | 1051 CreatePermanentNode(BookmarkNode::OTHER_NODE); |
| 1053 BookmarkPermanentNode* mobile_node = | 1052 BookmarkPermanentNode* mobile_node = |
| 1054 CreatePermanentNode(BookmarkNode::MOBILE); | 1053 CreatePermanentNode(BookmarkNode::MOBILE); |
| 1055 return new BookmarkLoadDetails(bb_node, other_node, mobile_node, | 1054 return new BookmarkLoadDetails(bb_node, other_node, mobile_node, |
| 1056 new BookmarkIndex(profile_), | 1055 new BookmarkIndex(profile_), |
| 1057 next_node_id_); | 1056 next_node_id_); |
| 1058 } | 1057 } |
| OLD | NEW |