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

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

Issue 11275088: Remove implicit scoped_refptr operator T* Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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
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/favicon/favicon_service_factory.h" 9 #include "chrome/browser/favicon/favicon_service_factory.h"
10 #include "chrome/browser/history/top_sites.h" 10 #include "chrome/browser/history/top_sites.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 FaviconService::Handle request_handle, 159 FaviconService::Handle request_handle,
160 const history::FaviconBitmapResult& bitmap_result) { 160 const history::FaviconBitmapResult& bitmap_result) {
161 FaviconService* favicon_service = 161 FaviconService* favicon_service =
162 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); 162 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
163 const IconRequest& request = 163 const IconRequest& request =
164 cancelable_consumer_.GetClientData(favicon_service, 164 cancelable_consumer_.GetClientData(favicon_service,
165 request_handle); 165 request_handle);
166 166
167 if (bitmap_result.is_valid()) { 167 if (bitmap_result.is_valid()) {
168 // Forward the data along to the networking system. 168 // Forward the data along to the networking system.
169 SendResponse(request.request_id, bitmap_result.bitmap_data); 169 SendResponse(request.request_id, bitmap_result.bitmap_data.get());
170 } else { 170 } else {
171 SendDefaultResponse(request); 171 SendDefaultResponse(request);
172 } 172 }
173 } 173 }
174 174
175 void FaviconSource::SendDefaultResponse(const IconRequest& icon_request) { 175 void FaviconSource::SendDefaultResponse(const IconRequest& icon_request) {
176 int favicon_index; 176 int favicon_index;
177 int resource_id; 177 int resource_id;
178 switch (icon_request.size_in_dip) { 178 switch (icon_request.size_in_dip) {
179 case 64: 179 case 64:
180 favicon_index = SIZE_64; 180 favicon_index = SIZE_64;
181 resource_id = IDR_DEFAULT_FAVICON_64; 181 resource_id = IDR_DEFAULT_FAVICON_64;
182 break; 182 break;
183 case 32: 183 case 32:
184 favicon_index = SIZE_32; 184 favicon_index = SIZE_32;
185 resource_id = IDR_DEFAULT_FAVICON_32; 185 resource_id = IDR_DEFAULT_FAVICON_32;
186 break; 186 break;
187 default: 187 default:
188 favicon_index = SIZE_16; 188 favicon_index = SIZE_16;
189 resource_id = IDR_DEFAULT_FAVICON; 189 resource_id = IDR_DEFAULT_FAVICON;
190 break; 190 break;
191 } 191 }
192 base::RefCountedMemory* default_favicon = default_favicons_[favicon_index]; 192 base::RefCountedMemory* default_favicon =
193 default_favicons_[favicon_index].get();
193 194
194 if (!default_favicon) { 195 if (!default_favicon) {
195 ui::ScaleFactor scale_factor = icon_request.scale_factor; 196 ui::ScaleFactor scale_factor = icon_request.scale_factor;
196 default_favicon = ResourceBundle::GetSharedInstance() 197 default_favicon = ResourceBundle::GetSharedInstance()
197 .LoadDataResourceBytes(resource_id, scale_factor); 198 .LoadDataResourceBytes(resource_id, scale_factor);
198 default_favicons_[favicon_index] = default_favicon; 199 default_favicons_[favicon_index] = default_favicon;
199 } 200 }
200 201
201 SendResponse(icon_request.request_id, default_favicon); 202 SendResponse(icon_request.request_id, default_favicon);
202 } 203 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/extensions/pack_extension_handler.cc ('k') | chrome/browser/ui/webui/nacl_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698