| 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 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 } | 770 } |
| 771 | 771 |
| 772 void BookmarkModel::OnFaviconDataAvailable( | 772 void BookmarkModel::OnFaviconDataAvailable( |
| 773 FaviconService::Handle handle, | 773 FaviconService::Handle handle, |
| 774 history::FaviconData favicon) { | 774 history::FaviconData favicon) { |
| 775 BookmarkNode* node = | 775 BookmarkNode* node = |
| 776 load_consumer_.GetClientData( | 776 load_consumer_.GetClientData( |
| 777 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS), handle); | 777 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS), handle); |
| 778 DCHECK(node); | 778 DCHECK(node); |
| 779 node->set_favicon_load_handle(0); | 779 node->set_favicon_load_handle(0); |
| 780 if (favicon.is_valid()) { | 780 if (favicon.is_valid() && favicon.variants.size() > 0) { |
| 781 scoped_ptr<gfx::Image> favicon_image( | 781 scoped_ptr<gfx::Image> favicon_image( |
| 782 gfx::ImageFromPNGEncodedData(favicon.bitmap_data->front(), | 782 gfx::ImageFromPNGEncodedData(favicon.variants[0].bitmap_data->front(), |
| 783 favicon.bitmap_data->size())); | 783 favicon.variants[0].bitmap_data->size())); |
| 784 if (favicon_image.get()) { | 784 if (favicon_image.get()) { |
| 785 node->set_favicon(*favicon_image.get()); | 785 node->set_favicon(*favicon_image.get()); |
| 786 FaviconLoaded(node); | 786 FaviconLoaded(node); |
| 787 } | 787 } |
| 788 } | 788 } |
| 789 } | 789 } |
| 790 | 790 |
| 791 void BookmarkModel::LoadFavicon(BookmarkNode* node) { | 791 void BookmarkModel::LoadFavicon(BookmarkNode* node) { |
| 792 if (node->is_folder()) | 792 if (node->is_folder()) |
| 793 return; | 793 return; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 BookmarkLoadDetails* BookmarkModel::CreateLoadDetails() { | 865 BookmarkLoadDetails* BookmarkModel::CreateLoadDetails() { |
| 866 BookmarkPermanentNode* bb_node = | 866 BookmarkPermanentNode* bb_node = |
| 867 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); | 867 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); |
| 868 BookmarkPermanentNode* other_node = | 868 BookmarkPermanentNode* other_node = |
| 869 CreatePermanentNode(BookmarkNode::OTHER_NODE); | 869 CreatePermanentNode(BookmarkNode::OTHER_NODE); |
| 870 BookmarkPermanentNode* mobile_node = | 870 BookmarkPermanentNode* mobile_node = |
| 871 CreatePermanentNode(BookmarkNode::MOBILE); | 871 CreatePermanentNode(BookmarkNode::MOBILE); |
| 872 return new BookmarkLoadDetails(bb_node, other_node, mobile_node, | 872 return new BookmarkLoadDetails(bb_node, other_node, mobile_node, |
| 873 new BookmarkIndex(profile_), next_node_id_); | 873 new BookmarkIndex(profile_), next_node_id_); |
| 874 } | 874 } |
| OLD | NEW |