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

Side by Side Diff: chrome/browser/ui/webui/extensions/extension_icon_source.cc

Issue 16290004: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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/extensions/extension_icon_source.h" 5 #include "chrome/browser/ui/webui/extensions/extension_icon_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 "base/memory/ref_counted_memory.h" 9 #include "base/memory/ref_counted_memory.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 235
236 // Fallback to the default icon if there wasn't a favicon. 236 // Fallback to the default icon if there wasn't a favicon.
237 if (!bitmap_result.is_valid()) { 237 if (!bitmap_result.is_valid()) {
238 LoadDefaultImage(request_id); 238 LoadDefaultImage(request_id);
239 return; 239 return;
240 } 240 }
241 241
242 if (!request->grayscale) { 242 if (!request->grayscale) {
243 // If we don't need a grayscale image, then we can bypass FinalizeImage 243 // If we don't need a grayscale image, then we can bypass FinalizeImage
244 // to avoid unnecessary conversions. 244 // to avoid unnecessary conversions.
245 request->callback.Run(bitmap_result.bitmap_data); 245 request->callback.Run(bitmap_result.bitmap_data.get());
246 ClearData(request_id); 246 ClearData(request_id);
247 } else { 247 } else {
248 FinalizeImage(ToBitmap(bitmap_result.bitmap_data->front(), 248 FinalizeImage(ToBitmap(bitmap_result.bitmap_data->front(),
249 bitmap_result.bitmap_data->size()), request_id); 249 bitmap_result.bitmap_data->size()), request_id);
250 } 250 }
251 } 251 }
252 252
253 void ExtensionIconSource::OnImageLoaded(int request_id, 253 void ExtensionIconSource::OnImageLoaded(int request_id,
254 const gfx::Image& image) { 254 const gfx::Image& image) {
255 if (image.IsEmpty()) 255 if (image.IsEmpty())
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 338
339 void ExtensionIconSource::ClearData(int request_id) { 339 void ExtensionIconSource::ClearData(int request_id) {
340 std::map<int, ExtensionIconRequest*>::iterator i = 340 std::map<int, ExtensionIconRequest*>::iterator i =
341 request_map_.find(request_id); 341 request_map_.find(request_id);
342 if (i == request_map_.end()) 342 if (i == request_map_.end())
343 return; 343 return;
344 344
345 delete i->second; 345 delete i->second;
346 request_map_.erase(i); 346 request_map_.erase(i);
347 } 347 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/devtools_ui.cc ('k') | chrome/browser/ui/webui/extensions/extension_settings_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698