OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |