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

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

Issue 9586018: Add support for multiple icon sizes for Mac platform apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build Created 8 years, 9 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/string_util.h" 10 #include "base/string_util.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 ExtensionIconSet::MATCH_EXACTLY); 81 ExtensionIconSet::MATCH_EXACTLY);
82 82
83 tracker_.LoadImage(extension_, icon_resource, 83 tracker_.LoadImage(extension_, icon_resource,
84 gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize), 84 gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize),
85 ImageLoadingTracker::DONT_CACHE); 85 ImageLoadingTracker::DONT_CACHE);
86 } else { 86 } else {
87 ForwardResult(NULL); 87 ForwardResult(NULL);
88 } 88 }
89 } 89 }
90 90
91 virtual void OnImageLoaded(SkBitmap* image, const ExtensionResource& resource, 91 virtual void OnImageLoaded(const gfx::Image& image,
92 int index) { 92 const std::string& extension_id,
93 if (image) { 93 int index) OVERRIDE {
94 if (!image.IsEmpty()) {
94 std::vector<unsigned char> image_data; 95 std::vector<unsigned char> image_data;
95 if (!gfx::PNGCodec::EncodeBGRASkBitmap(*image, false, &image_data)) { 96 if (!gfx::PNGCodec::EncodeBGRASkBitmap(*image.ToSkBitmap(), false,
97 &image_data)) {
96 NOTREACHED() << "Could not encode extension favicon"; 98 NOTREACHED() << "Could not encode extension favicon";
97 } 99 }
98 ForwardResult(RefCountedBytes::TakeVector(&image_data)); 100 ForwardResult(RefCountedBytes::TakeVector(&image_data));
99 } else { 101 } else {
100 ForwardResult(NULL); 102 ForwardResult(NULL);
101 } 103 }
102 } 104 }
103 105
104 private: 106 private:
105 ~ExtensionWebUIImageLoadingTracker() {} 107 ~ExtensionWebUIImageLoadingTracker() {}
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } 415 }
414 416
415 // static 417 // static
416 void ExtensionWebUI::GetFaviconForURL(Profile* profile, 418 void ExtensionWebUI::GetFaviconForURL(Profile* profile,
417 FaviconService::GetFaviconRequest* request, const GURL& page_url) { 419 FaviconService::GetFaviconRequest* request, const GURL& page_url) {
418 // tracker deletes itself when done. 420 // tracker deletes itself when done.
419 ExtensionWebUIImageLoadingTracker* tracker = 421 ExtensionWebUIImageLoadingTracker* tracker =
420 new ExtensionWebUIImageLoadingTracker(profile, request, page_url); 422 new ExtensionWebUIImageLoadingTracker(profile, request, page_url);
421 tracker->Init(); 423 tracker->Init();
422 } 424 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_uninstall_dialog.cc ('k') | chrome/browser/extensions/image_loading_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698