Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: chrome/browser/bookmarks/bookmark_model.cc

Issue 6651014: Applied the IconType. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: removed the callback6 Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/callback.h" 10 #include "base/callback.h"
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 node->SetTitle(l10n_util::GetStringUTF16(IDS_BOOMARK_BAR_FOLDER_NAME)); 727 node->SetTitle(l10n_util::GetStringUTF16(IDS_BOOMARK_BAR_FOLDER_NAME));
728 } else { 728 } else {
729 node->SetTitle( 729 node->SetTitle(
730 l10n_util::GetStringUTF16(IDS_BOOMARK_BAR_OTHER_FOLDER_NAME)); 730 l10n_util::GetStringUTF16(IDS_BOOMARK_BAR_OTHER_FOLDER_NAME));
731 } 731 }
732 return node; 732 return node;
733 } 733 }
734 734
735 void BookmarkModel::OnFavIconDataAvailable( 735 void BookmarkModel::OnFavIconDataAvailable(
736 FaviconService::Handle handle, 736 FaviconService::Handle handle,
737 bool know_favicon, 737 FaviconService::FaviconData favicon) {
738 scoped_refptr<RefCountedMemory> data,
739 bool expired,
740 GURL icon_url) {
741 SkBitmap fav_icon; 738 SkBitmap fav_icon;
742 BookmarkNode* node = 739 BookmarkNode* node =
743 load_consumer_.GetClientData( 740 load_consumer_.GetClientData(
744 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS), handle); 741 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS), handle);
745 DCHECK(node); 742 DCHECK(node);
746 node->set_favicon_load_handle(0); 743 node->set_favicon_load_handle(0);
747 if (know_favicon && data.get() && data->size() && 744 if (favicon.known_icon && favicon.image_data.get() &&
748 gfx::PNGCodec::Decode(data->front(), data->size(), &fav_icon)) { 745 favicon.image_data->size() &&
746 gfx::PNGCodec::Decode(favicon.image_data->front(),
747 favicon.image_data->size(), &fav_icon)) {
749 node->set_favicon(fav_icon); 748 node->set_favicon(fav_icon);
750 FavIconLoaded(node); 749 FavIconLoaded(node);
751 } 750 }
752 } 751 }
753 752
754 void BookmarkModel::LoadFavIcon(BookmarkNode* node) { 753 void BookmarkModel::LoadFavIcon(BookmarkNode* node) {
755 if (node->type() != BookmarkNode::URL) 754 if (node->type() != BookmarkNode::URL)
756 return; 755 return;
757 756
758 DCHECK(node->GetURL().is_valid()); 757 DCHECK(node->GetURL().is_valid());
759 FaviconService* favicon_service = 758 FaviconService* favicon_service =
760 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS); 759 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS);
761 if (!favicon_service) 760 if (!favicon_service)
762 return; 761 return;
763 FaviconService::Handle handle = favicon_service->GetFaviconForURL( 762 FaviconService::Handle handle = favicon_service->GetFaviconForURL(
764 node->GetURL(), &load_consumer_, 763 node->GetURL(), history::FAV_ICON, &load_consumer_,
765 NewCallback(this, &BookmarkModel::OnFavIconDataAvailable)); 764 NewCallback(this, &BookmarkModel::OnFavIconDataAvailable));
766 load_consumer_.SetClientData(favicon_service, handle, node); 765 load_consumer_.SetClientData(favicon_service, handle, node);
767 node->set_favicon_load_handle(handle); 766 node->set_favicon_load_handle(handle);
768 } 767 }
769 768
770 void BookmarkModel::CancelPendingFavIconLoadRequests(BookmarkNode* node) { 769 void BookmarkModel::CancelPendingFavIconLoadRequests(BookmarkNode* node) {
771 if (node->favicon_load_handle()) { 770 if (node->favicon_load_handle()) {
772 FaviconService* favicon_service = 771 FaviconService* favicon_service =
773 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS); 772 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS);
774 if (favicon_service) 773 if (favicon_service)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 void BookmarkModel::SetFileChanged() { 821 void BookmarkModel::SetFileChanged() {
823 file_changed_ = true; 822 file_changed_ = true;
824 } 823 }
825 824
826 BookmarkLoadDetails* BookmarkModel::CreateLoadDetails() { 825 BookmarkLoadDetails* BookmarkModel::CreateLoadDetails() {
827 BookmarkNode* bb_node = CreateBookmarkNode(); 826 BookmarkNode* bb_node = CreateBookmarkNode();
828 BookmarkNode* other_folder_node = CreateOtherBookmarksNode(); 827 BookmarkNode* other_folder_node = CreateOtherBookmarksNode();
829 return new BookmarkLoadDetails( 828 return new BookmarkLoadDetails(
830 bb_node, other_folder_node, new BookmarkIndex(profile()), next_node_id_); 829 bb_node, other_folder_node, new BookmarkIndex(profile()), next_node_id_);
831 } 830 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698