| OLD | NEW |
| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 428 |
| 429 if (sync_transaction_version == node->sync_transaction_version()) | 429 if (sync_transaction_version == node->sync_transaction_version()) |
| 430 return; | 430 return; |
| 431 | 431 |
| 432 AsMutable(node)->set_sync_transaction_version(sync_transaction_version); | 432 AsMutable(node)->set_sync_transaction_version(sync_transaction_version); |
| 433 if (store_.get()) | 433 if (store_.get()) |
| 434 store_->ScheduleSave(); | 434 store_->ScheduleSave(); |
| 435 } | 435 } |
| 436 | 436 |
| 437 void BookmarkModel::OnFaviconChanged(const std::set<GURL>& urls) { | 437 void BookmarkModel::OnFaviconChanged(const std::set<GURL>& urls) { |
| 438 // Ignore events if |Load| has not been called yet. | |
| 439 if (!store_) | |
| 440 return; | |
| 441 | |
| 442 // Prevent the observers from getting confused for multiple favicon loads. | 438 // Prevent the observers from getting confused for multiple favicon loads. |
| 443 for (std::set<GURL>::const_iterator i = urls.begin(); i != urls.end(); ++i) { | 439 for (std::set<GURL>::const_iterator i = urls.begin(); i != urls.end(); ++i) { |
| 444 std::vector<const BookmarkNode*> nodes; | 440 std::vector<const BookmarkNode*> nodes; |
| 445 GetNodesByURL(*i, &nodes); | 441 GetNodesByURL(*i, &nodes); |
| 446 for (size_t i = 0; i < nodes.size(); ++i) { | 442 for (size_t i = 0; i < nodes.size(); ++i) { |
| 447 // Got an updated favicon, for a URL, do a new request. | 443 // Got an updated favicon, for a URL, do a new request. |
| 448 BookmarkNode* node = AsMutable(nodes[i]); | 444 BookmarkNode* node = AsMutable(nodes[i]); |
| 449 node->InvalidateFavicon(); | 445 node->InvalidateFavicon(); |
| 450 CancelPendingFaviconLoadRequests(node); | 446 CancelPendingFaviconLoadRequests(node); |
| 451 FOR_EACH_OBSERVER(BookmarkModelObserver, | 447 FOR_EACH_OBSERVER(BookmarkModelObserver, |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 return scoped_ptr<BookmarkLoadDetails>(new BookmarkLoadDetails( | 1024 return scoped_ptr<BookmarkLoadDetails>(new BookmarkLoadDetails( |
| 1029 bb_node, | 1025 bb_node, |
| 1030 other_node, | 1026 other_node, |
| 1031 mobile_node, | 1027 mobile_node, |
| 1032 client_->GetLoadExtraNodesCallback(), | 1028 client_->GetLoadExtraNodesCallback(), |
| 1033 new BookmarkIndex(client_, accept_languages), | 1029 new BookmarkIndex(client_, accept_languages), |
| 1034 next_node_id_)); | 1030 next_node_id_)); |
| 1035 } | 1031 } |
| 1036 | 1032 |
| 1037 } // namespace bookmarks | 1033 } // namespace bookmarks |
| OLD | NEW |