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 BookmarkNode* node = | 780 BookmarkNode* node = |
781 load_consumer_.GetClientData( | 781 load_consumer_.GetClientData( |
782 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS), handle); | 782 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS), handle); |
783 DCHECK(node); | 783 DCHECK(node); |
784 node->set_favicon_load_handle(0); | 784 node->set_favicon_load_handle(0); |
785 if (favicon.is_valid()) { | 785 if (favicon_data.is_valid()) { |
786 scoped_refptr<base::RefCountedMemory> bitmap_data = | |
787 favicon_data.elements[0].bitmap_data; | |
stevenjb
2012/08/15 22:59:18
nit: use constructor instead of assignment
| |
786 scoped_ptr<gfx::Image> favicon_image( | 788 scoped_ptr<gfx::Image> favicon_image( |
787 gfx::ImageFromPNGEncodedData(favicon.image_data->front(), | 789 gfx::ImageFromPNGEncodedData(bitmap_data->front(), |
788 favicon.image_data->size())); | 790 bitmap_data->size())); |
789 if (favicon_image.get()) { | 791 if (favicon_image.get()) { |
790 node->set_favicon(*favicon_image.get()); | 792 node->set_favicon(*favicon_image.get()); |
791 FaviconLoaded(node); | 793 FaviconLoaded(node); |
792 } | 794 } |
793 } | 795 } |
794 } | 796 } |
795 | 797 |
796 void BookmarkModel::LoadFavicon(BookmarkNode* node) { | 798 void BookmarkModel::LoadFavicon(BookmarkNode* node) { |
797 if (node->is_folder()) | 799 if (node->is_folder()) |
798 return; | 800 return; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
870 BookmarkLoadDetails* BookmarkModel::CreateLoadDetails() { | 872 BookmarkLoadDetails* BookmarkModel::CreateLoadDetails() { |
871 BookmarkPermanentNode* bb_node = | 873 BookmarkPermanentNode* bb_node = |
872 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); | 874 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); |
873 BookmarkPermanentNode* other_node = | 875 BookmarkPermanentNode* other_node = |
874 CreatePermanentNode(BookmarkNode::OTHER_NODE); | 876 CreatePermanentNode(BookmarkNode::OTHER_NODE); |
875 BookmarkPermanentNode* mobile_node = | 877 BookmarkPermanentNode* mobile_node = |
876 CreatePermanentNode(BookmarkNode::MOBILE); | 878 CreatePermanentNode(BookmarkNode::MOBILE); |
877 return new BookmarkLoadDetails(bb_node, other_node, mobile_node, | 879 return new BookmarkLoadDetails(bb_node, other_node, mobile_node, |
878 new BookmarkIndex(profile_), next_node_id_); | 880 new BookmarkIndex(profile_), next_node_id_); |
879 } | 881 } |
OLD | NEW |