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

Side by Side Diff: chrome/browser/ui/views/create_application_shortcut_view.cc

Issue 9428025: Add support for multiple icon sizes for Mac platform apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comment 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 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/views/create_application_shortcut_view.h" 5 #include "chrome/browser/ui/views/create_application_shortcut_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 17 matching lines...) Expand all
28 #include "grit/theme_resources.h" 28 #include "grit/theme_resources.h"
29 #include "net/base/load_flags.h" 29 #include "net/base/load_flags.h"
30 #include "net/url_request/url_request.h" 30 #include "net/url_request/url_request.h"
31 #include "third_party/skia/include/core/SkBitmap.h" 31 #include "third_party/skia/include/core/SkBitmap.h"
32 #include "third_party/skia/include/core/SkPaint.h" 32 #include "third_party/skia/include/core/SkPaint.h"
33 #include "third_party/skia/include/core/SkRect.h" 33 #include "third_party/skia/include/core/SkRect.h"
34 #include "ui/base/l10n/l10n_util.h" 34 #include "ui/base/l10n/l10n_util.h"
35 #include "ui/base/resource/resource_bundle.h" 35 #include "ui/base/resource/resource_bundle.h"
36 #include "ui/gfx/canvas_skia.h" 36 #include "ui/gfx/canvas_skia.h"
37 #include "ui/gfx/codec/png_codec.h" 37 #include "ui/gfx/codec/png_codec.h"
38 #include "ui/gfx/image/image.h"
38 #include "ui/views/controls/button/checkbox.h" 39 #include "ui/views/controls/button/checkbox.h"
39 #include "ui/views/controls/image_view.h" 40 #include "ui/views/controls/image_view.h"
40 #include "ui/views/controls/label.h" 41 #include "ui/views/controls/label.h"
41 #include "ui/views/layout/grid_layout.h" 42 #include "ui/views/layout/grid_layout.h"
42 #include "ui/views/layout/layout_constants.h" 43 #include "ui/views/layout/layout_constants.h"
43 #include "ui/views/widget/widget.h" 44 #include "ui/views/widget/widget.h"
44 45
45 namespace { 46 namespace {
46 47
47 const int kAppIconSize = 32; 48 const int kAppIconSize = 32;
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 tracker_.LoadImage(app_, 516 tracker_.LoadImage(app_,
516 icon_resource, 517 icon_resource,
517 max_size, 518 max_size,
518 ImageLoadingTracker::DONT_CACHE); 519 ImageLoadingTracker::DONT_CACHE);
519 } 520 }
520 521
521 CreateChromeApplicationShortcutView::~CreateChromeApplicationShortcutView() {} 522 CreateChromeApplicationShortcutView::~CreateChromeApplicationShortcutView() {}
522 523
523 // Called by tracker_ when the app's icon is loaded. 524 // Called by tracker_ when the app's icon is loaded.
524 void CreateChromeApplicationShortcutView::OnImageLoaded( 525 void CreateChromeApplicationShortcutView::OnImageLoaded(
525 SkBitmap* image, const ExtensionResource& resource, int index) { 526 const gfx::Image* image,
526 if (!image || image->isNull()) 527 const std::string& extension_id,
527 image = ExtensionIconSource::LoadImageByResourceId(IDR_APP_DEFAULT_ICON); 528 int index) {
529 if (!image || image->IsEmpty()) {
530 shortcut_info_.favicon =
531 ResourceBundle::GetSharedInstance().GetImageNamed(IDR_APP_DEFAULT_ICON);
532 } else {
533 shortcut_info_.favicon = *image;
534 }
528 535
529 shortcut_info_.favicon = *image;
530 CHECK(app_info_); 536 CHECK(app_info_);
531 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); 537 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon);
532 } 538 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698