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

Side by Side Diff: chrome/browser/ui/webui/favicon_source.cc

Issue 10821035: wip Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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) 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/ui/webui/favicon_source.h" 5 #include "chrome/browser/ui/webui/favicon_source.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "chrome/browser/history/top_sites.h" 9 #include "chrome/browser/history/top_sites.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 void FaviconSource::OnFaviconDataAvailable( 131 void FaviconSource::OnFaviconDataAvailable(
132 FaviconService::Handle request_handle, 132 FaviconService::Handle request_handle,
133 history::FaviconData favicon) { 133 history::FaviconData favicon) {
134 FaviconService* favicon_service = 134 FaviconService* favicon_service =
135 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS); 135 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS);
136 int request_id = cancelable_consumer_.GetClientData(favicon_service, 136 int request_id = cancelable_consumer_.GetClientData(favicon_service,
137 request_handle); 137 request_handle);
138 138
139 if (favicon.is_valid()) { 139 if (favicon.is_valid()) {
140 // Forward the data along to the networking system. 140 // Forward the data along to the networking system.
141 SendResponse(request_id, favicon.bitmap_data); 141 SendResponse(request_id, favicon.variants[0].bitmap_data); // XX
142 } else { 142 } else {
143 SendDefaultResponse(request_id); 143 SendDefaultResponse(request_id);
144 } 144 }
145 } 145 }
146 146
147 void FaviconSource::SendDefaultResponse(int request_id) { 147 void FaviconSource::SendDefaultResponse(int request_id) {
148 base::RefCountedMemory* bytes = NULL; 148 base::RefCountedMemory* bytes = NULL;
149 if (request_size_map_[request_id] == 32) { 149 if (request_size_map_[request_id] == 32) {
150 if (!default_favicon_large_.get()) { 150 if (!default_favicon_large_.get()) {
151 default_favicon_large_ = 151 default_favicon_large_ =
152 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( 152 ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
153 IDR_DEFAULT_LARGE_FAVICON, ui::SCALE_FACTOR_100P); 153 IDR_DEFAULT_LARGE_FAVICON, ui::SCALE_FACTOR_100P);
154 } 154 }
155 bytes = default_favicon_large_; 155 bytes = default_favicon_large_;
156 } else { 156 } else {
157 if (!default_favicon_.get()) { 157 if (!default_favicon_.get()) {
158 default_favicon_ = 158 default_favicon_ =
159 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( 159 ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
160 IDR_DEFAULT_FAVICON, ui::SCALE_FACTOR_100P); 160 IDR_DEFAULT_FAVICON, ui::SCALE_FACTOR_100P);
161 } 161 }
162 bytes = default_favicon_; 162 bytes = default_favicon_;
163 } 163 }
164 request_size_map_.erase(request_id); 164 request_size_map_.erase(request_id);
165 165
166 SendResponse(request_id, bytes); 166 SendResponse(request_id, bytes);
167 } 167 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/extensions/extension_icon_source.cc ('k') | chrome/browser/ui/webui/ntp/app_launcher_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698