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

Side by Side Diff: chrome/browser/ui/webui/ntp/favicon_webui_handler.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/ui/webui/ntp/favicon_webui_handler.h" 5 #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.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/string_split.h" 9 #include "base/string_split.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 // Thin inheritance-dependent trampoline to forward notification of app 44 // Thin inheritance-dependent trampoline to forward notification of app
45 // icon loads to the FaviconWebUIHandler. Base class does caching of icons. 45 // icon loads to the FaviconWebUIHandler. Base class does caching of icons.
46 class ExtensionIconColorManager : public ExtensionIconManager { 46 class ExtensionIconColorManager : public ExtensionIconManager {
47 public: 47 public:
48 explicit ExtensionIconColorManager(FaviconWebUIHandler* handler) 48 explicit ExtensionIconColorManager(FaviconWebUIHandler* handler)
49 : ExtensionIconManager(), 49 : ExtensionIconManager(),
50 handler_(handler) {} 50 handler_(handler) {}
51 virtual ~ExtensionIconColorManager() {} 51 virtual ~ExtensionIconColorManager() {}
52 52
53 virtual void OnImageLoaded(SkBitmap* image, 53 virtual void OnImageLoaded(const gfx::Image& image,
54 const ExtensionResource& resource, 54 const std::string& extension_id,
55 int index) OVERRIDE { 55 int index) OVERRIDE {
56 ExtensionIconManager::OnImageLoaded(image, resource, index); 56 ExtensionIconManager::OnImageLoaded(image, extension_id, index);
57 handler_->NotifyAppIconReady(resource.extension_id()); 57 handler_->NotifyAppIconReady(extension_id);
58 } 58 }
59 59
60 private: 60 private:
61 FaviconWebUIHandler* handler_; 61 FaviconWebUIHandler* handler_;
62 }; 62 };
63 63
64 FaviconWebUIHandler::FaviconWebUIHandler() 64 FaviconWebUIHandler::FaviconWebUIHandler()
65 : id_(0), 65 : id_(0),
66 app_icon_color_manager_(new ExtensionIconColorManager(this)) { 66 app_icon_color_manager_(new ExtensionIconColorManager(this)) {
67 } 67 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 std::vector<unsigned char> bits; 155 std::vector<unsigned char> bits;
156 if (!gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &bits)) 156 if (!gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &bits))
157 return; 157 return;
158 scoped_refptr<RefCountedStaticMemory> bits_mem( 158 scoped_refptr<RefCountedStaticMemory> bits_mem(
159 new RefCountedStaticMemory(&bits.front(), bits.size())); 159 new RefCountedStaticMemory(&bits.front(), bits.size()));
160 scoped_ptr<StringValue> color_value(GetDominantColorCssString(bits_mem)); 160 scoped_ptr<StringValue> color_value(GetDominantColorCssString(bits_mem));
161 StringValue id(extension_id); 161 StringValue id(extension_id);
162 web_ui()->CallJavascriptFunction( 162 web_ui()->CallJavascriptFunction(
163 "ntp.setStripeColor", id, *color_value); 163 "ntp.setStripeColor", id, *color_value);
164 } 164 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/extensions/extension_icon_source.cc ('k') | chrome/browser/web_applications/web_app_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698