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

Unified Diff: chrome/browser/ui/views/create_application_shortcut_view.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, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/create_application_shortcut_view.cc
diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc
index 77b6be30b38e231ab2522755c5e4bc8145ba56f6..ffa2084fc4faeddb77861226b78fcce45480529d 100644
--- a/chrome/browser/ui/views/create_application_shortcut_view.cc
+++ b/chrome/browser/ui/views/create_application_shortcut_view.cc
@@ -57,7 +57,7 @@ class AppInfoView : public views::View {
void UpdateText(const string16& title, const string16& description);
// Updates the icon of the web app.
- void UpdateIcon(const SkBitmap& new_icon);
+ void UpdateIcon(const gfx::Image& image);
// Overridden from views::View:
virtual void OnPaint(gfx::Canvas* canvas);
@@ -159,8 +159,9 @@ void AppInfoView::UpdateText(const string16& title,
SetupLayout();
}
-void AppInfoView::UpdateIcon(const SkBitmap& new_icon) {
- icon_->SetImage(new_icon);
+void AppInfoView::UpdateIcon(const gfx::Image& image) {
+ if (!image.IsEmpty())
+ icon_->SetImage(image.ToSkBitmap());
}
void AppInfoView::OnPaint(gfx::Canvas* canvas) {
@@ -469,7 +470,7 @@ void CreateUrlApplicationShortcutView::OnIconDownloaded(bool errored,
pending_download_ = NULL;
if (!errored && !image.isNull()) {
- shortcut_info_.favicon = image;
+ shortcut_info_.favicon = gfx::Image(image);
static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon);
} else {
FetchIcon();
@@ -522,11 +523,16 @@ CreateChromeApplicationShortcutView::~CreateChromeApplicationShortcutView() {}
// Called by tracker_ when the app's icon is loaded.
void CreateChromeApplicationShortcutView::OnImageLoaded(
- SkBitmap* image, const ExtensionResource& resource, int index) {
- if (!image || image->isNull())
- image = ExtensionIconSource::LoadImageByResourceId(IDR_APP_DEFAULT_ICON);
+ const gfx::Image& image,
+ const std::string& extension_id,
+ int index) {
+ if (image.IsEmpty()) {
+ shortcut_info_.favicon = ui::ResourceBundle::GetSharedInstance().
+ GetImageNamed(IDR_APP_DEFAULT_ICON);
+ } else {
+ shortcut_info_.favicon = image;
+ }
- shortcut_info_.favicon = *image;
CHECK(app_info_);
static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon);
}
« no previous file with comments | « chrome/browser/ui/views/create_application_shortcut_view.h ('k') | chrome/browser/ui/views/infobars/extension_infobar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698