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" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 if (!profile_) { | 207 if (!profile_) { |
208 // Profile is null during testing. | 208 // Profile is null during testing. |
209 DoneLoading(CreateLoadDetails()); | 209 DoneLoading(CreateLoadDetails()); |
210 } | 210 } |
211 } | 211 } |
212 | 212 |
213 BookmarkModel::~BookmarkModel() { | 213 BookmarkModel::~BookmarkModel() { |
214 FOR_EACH_OBSERVER(BookmarkModelObserver, observers_, | 214 FOR_EACH_OBSERVER(BookmarkModelObserver, observers_, |
215 BookmarkModelBeingDeleted(this)); | 215 BookmarkModelBeingDeleted(this)); |
216 | 216 |
217 if (store_) { | 217 if (store_.get()) { |
218 // The store maintains a reference back to us. We need to tell it we're gone | 218 // The store maintains a reference back to us. We need to tell it we're gone |
219 // so that it doesn't try and invoke a method back on us again. | 219 // so that it doesn't try and invoke a method back on us again. |
220 store_->BookmarkModelDeleted(); | 220 store_->BookmarkModelDeleted(); |
221 } | 221 } |
222 } | 222 } |
223 | 223 |
224 void BookmarkModel::Shutdown() { | 224 void BookmarkModel::Shutdown() { |
225 if (loaded_) | 225 if (loaded_) |
226 return; | 226 return; |
227 | 227 |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 BookmarkNodeRemoved(this, parent, index, node.get())); | 789 BookmarkNodeRemoved(this, parent, index, node.get())); |
790 | 790 |
791 if (details.changed_urls.empty()) { | 791 if (details.changed_urls.empty()) { |
792 // No point in sending out notification if the starred state didn't change. | 792 // No point in sending out notification if the starred state didn't change. |
793 return; | 793 return; |
794 } | 794 } |
795 | 795 |
796 if (profile_) { | 796 if (profile_) { |
797 HistoryService* history = | 797 HistoryService* history = |
798 HistoryServiceFactory::GetForProfile(profile_, | 798 HistoryServiceFactory::GetForProfile(profile_, |
799 Profile::EXPLICIT_ACCESS); | 799 Profile::EXPLICIT_ACCESS).get(); |
800 if (history) | 800 if (history) |
801 history->URLsNoLongerBookmarked(details.changed_urls); | 801 history->URLsNoLongerBookmarked(details.changed_urls); |
802 } | 802 } |
803 | 803 |
804 content::NotificationService::current()->Notify( | 804 content::NotificationService::current()->Notify( |
805 chrome::NOTIFICATION_URLS_STARRED, | 805 chrome::NOTIFICATION_URLS_STARRED, |
806 content::Source<content::BrowserContext>(profile_), | 806 content::Source<content::BrowserContext>(profile_), |
807 content::Details<history::URLsStarredDetails>(&details)); | 807 content::Details<history::URLsStarredDetails>(&details)); |
808 } | 808 } |
809 | 809 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 BookmarkPermanentNode* bb_node = | 979 BookmarkPermanentNode* bb_node = |
980 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); | 980 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); |
981 BookmarkPermanentNode* other_node = | 981 BookmarkPermanentNode* other_node = |
982 CreatePermanentNode(BookmarkNode::OTHER_NODE); | 982 CreatePermanentNode(BookmarkNode::OTHER_NODE); |
983 BookmarkPermanentNode* mobile_node = | 983 BookmarkPermanentNode* mobile_node = |
984 CreatePermanentNode(BookmarkNode::MOBILE); | 984 CreatePermanentNode(BookmarkNode::MOBILE); |
985 return new BookmarkLoadDetails(bb_node, other_node, mobile_node, | 985 return new BookmarkLoadDetails(bb_node, other_node, mobile_node, |
986 new BookmarkIndex(profile_), | 986 new BookmarkIndex(profile_), |
987 next_node_id_); | 987 next_node_id_); |
988 } | 988 } |
OLD | NEW |