| 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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 title_id = IDS_BOOKMARK_BAR_FOLDER_NAME; | 769 title_id = IDS_BOOKMARK_BAR_FOLDER_NAME; |
| 770 break; | 770 break; |
| 771 } | 771 } |
| 772 node->SetTitle(l10n_util::GetStringUTF16(title_id)); | 772 node->SetTitle(l10n_util::GetStringUTF16(title_id)); |
| 773 node->set_type(type); | 773 node->set_type(type); |
| 774 return node; | 774 return node; |
| 775 } | 775 } |
| 776 | 776 |
| 777 void BookmarkModel::OnFaviconDataAvailable( | 777 void BookmarkModel::OnFaviconDataAvailable( |
| 778 FaviconService::Handle handle, | 778 FaviconService::Handle handle, |
| 779 history::FaviconData favicon) { | 779 history::FaviconData favicon_data, |
| 780 std::vector<GURL> icon_urls_in_db) { |
| 780 BookmarkNode* node = | 781 BookmarkNode* node = |
| 781 load_consumer_.GetClientData( | 782 load_consumer_.GetClientData( |
| 782 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS), handle); | 783 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS), handle); |
| 783 DCHECK(node); | 784 DCHECK(node); |
| 784 node->set_favicon_load_handle(0); | 785 node->set_favicon_load_handle(0); |
| 785 if (favicon.is_valid()) { | 786 if (favicon_data.has_valid_bitmaps()) { |
| 787 scoped_refptr<base::RefCountedMemory> bitmap_data( |
| 788 favicon_data.first_bitmap()); |
| 786 scoped_ptr<gfx::Image> favicon_image( | 789 scoped_ptr<gfx::Image> favicon_image( |
| 787 gfx::ImageFromPNGEncodedData(favicon.image_data->front(), | 790 gfx::ImageFromPNGEncodedData(bitmap_data->front(), |
| 788 favicon.image_data->size())); | 791 bitmap_data->size())); |
| 789 if (favicon_image.get()) { | 792 if (favicon_image.get()) { |
| 790 node->set_favicon(*favicon_image.get()); | 793 node->set_favicon(*favicon_image.get()); |
| 791 FaviconLoaded(node); | 794 FaviconLoaded(node); |
| 792 } | 795 } |
| 793 } | 796 } |
| 794 } | 797 } |
| 795 | 798 |
| 796 void BookmarkModel::LoadFavicon(BookmarkNode* node) { | 799 void BookmarkModel::LoadFavicon(BookmarkNode* node) { |
| 797 if (node->is_folder()) | 800 if (node->is_folder()) |
| 798 return; | 801 return; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 BookmarkLoadDetails* BookmarkModel::CreateLoadDetails() { | 873 BookmarkLoadDetails* BookmarkModel::CreateLoadDetails() { |
| 871 BookmarkPermanentNode* bb_node = | 874 BookmarkPermanentNode* bb_node = |
| 872 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); | 875 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); |
| 873 BookmarkPermanentNode* other_node = | 876 BookmarkPermanentNode* other_node = |
| 874 CreatePermanentNode(BookmarkNode::OTHER_NODE); | 877 CreatePermanentNode(BookmarkNode::OTHER_NODE); |
| 875 BookmarkPermanentNode* mobile_node = | 878 BookmarkPermanentNode* mobile_node = |
| 876 CreatePermanentNode(BookmarkNode::MOBILE); | 879 CreatePermanentNode(BookmarkNode::MOBILE); |
| 877 return new BookmarkLoadDetails(bb_node, other_node, mobile_node, | 880 return new BookmarkLoadDetails(bb_node, other_node, mobile_node, |
| 878 new BookmarkIndex(profile_), next_node_id_); | 881 new BookmarkIndex(profile_), next_node_id_); |
| 879 } | 882 } |
| OLD | NEW |