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

Side by Side Diff: chrome/browser/extensions/extension_web_ui.cc

Issue 330603004: Rename FaviconBitmapXxx to FaviconRawBitmapXxx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android Created 6 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/extensions/extension_web_ui.h" 5 #include "chrome/browser/extensions/extension_web_ui.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 web_contents->GetController().LoadURL( 83 web_contents->GetController().LoadURL(
84 url, content::Referrer(url, blink::WebReferrerPolicyDefault), 84 url, content::Referrer(url, blink::WebReferrerPolicyDefault),
85 content::PAGE_TRANSITION_RELOAD, std::string()); 85 content::PAGE_TRANSITION_RELOAD, std::string());
86 } 86 }
87 87
88 // Run favicon callbck with image result. If no favicon was available then 88 // Run favicon callbck with image result. If no favicon was available then
89 // |image| will be empty. 89 // |image| will be empty.
90 void RunFaviconCallbackAsync( 90 void RunFaviconCallbackAsync(
91 const favicon_base::FaviconResultsCallback& callback, 91 const favicon_base::FaviconResultsCallback& callback,
92 const gfx::Image& image) { 92 const gfx::Image& image) {
93 std::vector<favicon_base::FaviconBitmapResult>* favicon_bitmap_results = 93 std::vector<favicon_base::FaviconRawBitmapResult>* favicon_bitmap_results =
94 new std::vector<favicon_base::FaviconBitmapResult>(); 94 new std::vector<favicon_base::FaviconRawBitmapResult>();
95 95
96 const std::vector<gfx::ImageSkiaRep>& image_reps = 96 const std::vector<gfx::ImageSkiaRep>& image_reps =
97 image.AsImageSkia().image_reps(); 97 image.AsImageSkia().image_reps();
98 for (size_t i = 0; i < image_reps.size(); ++i) { 98 for (size_t i = 0; i < image_reps.size(); ++i) {
99 const gfx::ImageSkiaRep& image_rep = image_reps[i]; 99 const gfx::ImageSkiaRep& image_rep = image_reps[i];
100 scoped_refptr<base::RefCountedBytes> bitmap_data( 100 scoped_refptr<base::RefCountedBytes> bitmap_data(
101 new base::RefCountedBytes()); 101 new base::RefCountedBytes());
102 if (gfx::PNGCodec::EncodeBGRASkBitmap(image_rep.sk_bitmap(), 102 if (gfx::PNGCodec::EncodeBGRASkBitmap(image_rep.sk_bitmap(),
103 false, 103 false,
104 &bitmap_data->data())) { 104 &bitmap_data->data())) {
105 favicon_base::FaviconBitmapResult bitmap_result; 105 favicon_base::FaviconRawBitmapResult bitmap_result;
106 bitmap_result.bitmap_data = bitmap_data; 106 bitmap_result.bitmap_data = bitmap_data;
107 bitmap_result.pixel_size = gfx::Size(image_rep.pixel_width(), 107 bitmap_result.pixel_size = gfx::Size(image_rep.pixel_width(),
108 image_rep.pixel_height()); 108 image_rep.pixel_height());
109 // Leave |bitmap_result|'s icon URL as the default of GURL(). 109 // Leave |bitmap_result|'s icon URL as the default of GURL().
110 bitmap_result.icon_type = favicon_base::FAVICON; 110 bitmap_result.icon_type = favicon_base::FAVICON;
111 111
112 favicon_bitmap_results->push_back(bitmap_result); 112 favicon_bitmap_results->push_back(bitmap_result);
113 } else { 113 } else {
114 NOTREACHED() << "Could not encode extension favicon"; 114 NOTREACHED() << "Could not encode extension favicon";
115 } 115 }
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 extensions::ImageLoader::ImageRepresentation::ALWAYS_RESIZE, 441 extensions::ImageLoader::ImageRepresentation::ALWAYS_RESIZE,
442 gfx::Size(pixel_size, pixel_size), 442 gfx::Size(pixel_size, pixel_size),
443 scale_factors[i])); 443 scale_factors[i]));
444 } 444 }
445 445
446 // LoadImagesAsync actually can run callback synchronously. We want to force 446 // LoadImagesAsync actually can run callback synchronously. We want to force
447 // async. 447 // async.
448 extensions::ImageLoader::Get(profile)->LoadImagesAsync( 448 extensions::ImageLoader::Get(profile)->LoadImagesAsync(
449 extension, info_list, base::Bind(&RunFaviconCallbackAsync, callback)); 449 extension, info_list, base::Bind(&RunFaviconCallbackAsync, callback));
450 } 450 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/management/management_api.cc ('k') | chrome/browser/favicon/favicon_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698