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

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

Issue 11428004: Sync the bookmark's icon URL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years 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) 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 void BookmarkNode::Initialize(int64 id) { 137 void BookmarkNode::Initialize(int64 id) {
138 id_ = id; 138 id_ = id;
139 type_ = url_.is_empty() ? FOLDER : URL; 139 type_ = url_.is_empty() ? FOLDER : URL;
140 date_added_ = Time::Now(); 140 date_added_ = Time::Now();
141 favicon_state_ = INVALID_FAVICON; 141 favicon_state_ = INVALID_FAVICON;
142 favicon_load_handle_ = 0; 142 favicon_load_handle_ = 0;
143 meta_info_str_.clear(); 143 meta_info_str_.clear();
144 } 144 }
145 145
146 void BookmarkNode::InvalidateFavicon() { 146 void BookmarkNode::InvalidateFavicon() {
147 icon_url_ = GURL();
147 favicon_ = gfx::Image(); 148 favicon_ = gfx::Image();
148 favicon_state_ = INVALID_FAVICON; 149 favicon_state_ = INVALID_FAVICON;
149 } 150 }
150 151
151 namespace { 152 namespace {
152 153
153 // Comparator used when sorting bookmarks. Folders are sorted first, then 154 // Comparator used when sorting bookmarks. Folders are sorted first, then
154 // bookmarks. 155 // bookmarks.
155 class SortComparator : public std::binary_function<const BookmarkNode*, 156 class SortComparator : public std::binary_function<const BookmarkNode*,
156 const BookmarkNode*, 157 const BookmarkNode*,
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 const history::FaviconImageResult& image_result) { 888 const history::FaviconImageResult& image_result) {
888 BookmarkNode* node = 889 BookmarkNode* node =
889 load_consumer_.GetClientData( 890 load_consumer_.GetClientData(
890 FaviconServiceFactory::GetForProfile( 891 FaviconServiceFactory::GetForProfile(
891 profile_, Profile::EXPLICIT_ACCESS), handle); 892 profile_, Profile::EXPLICIT_ACCESS), handle);
892 DCHECK(node); 893 DCHECK(node);
893 node->set_favicon_load_handle(0); 894 node->set_favicon_load_handle(0);
894 node->set_favicon_state(BookmarkNode::LOADED_FAVICON); 895 node->set_favicon_state(BookmarkNode::LOADED_FAVICON);
895 if (!image_result.image.IsEmpty()) { 896 if (!image_result.image.IsEmpty()) {
896 node->set_favicon(image_result.image); 897 node->set_favicon(image_result.image);
898 node->set_icon_url(image_result.icon_url);
897 FaviconLoaded(node); 899 FaviconLoaded(node);
898 } 900 }
899 } 901 }
900 902
901 void BookmarkModel::LoadFavicon(BookmarkNode* node) { 903 void BookmarkModel::LoadFavicon(BookmarkNode* node) {
902 if (node->is_folder()) 904 if (node->is_folder())
903 return; 905 return;
904 906
905 DCHECK(node->url().is_valid()); 907 DCHECK(node->url().is_valid());
906 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( 908 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 BookmarkPermanentNode* bb_node = 979 BookmarkPermanentNode* bb_node =
978 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR); 980 CreatePermanentNode(BookmarkNode::BOOKMARK_BAR);
979 BookmarkPermanentNode* other_node = 981 BookmarkPermanentNode* other_node =
980 CreatePermanentNode(BookmarkNode::OTHER_NODE); 982 CreatePermanentNode(BookmarkNode::OTHER_NODE);
981 BookmarkPermanentNode* mobile_node = 983 BookmarkPermanentNode* mobile_node =
982 CreatePermanentNode(BookmarkNode::MOBILE); 984 CreatePermanentNode(BookmarkNode::MOBILE);
983 return new BookmarkLoadDetails(bb_node, other_node, mobile_node, 985 return new BookmarkLoadDetails(bb_node, other_node, mobile_node,
984 new BookmarkIndex(profile_), 986 new BookmarkIndex(profile_),
985 next_node_id_); 987 next_node_id_);
986 } 988 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model.h ('k') | chrome/browser/sync/glue/bookmark_change_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698