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

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

Issue 7065037: Fix crash when creating a desktop shortcut for apps with a missing icon. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/callback.h" 7 #include "base/callback.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "base/win/windows_version.h" 9 #include "base/win/windows_version.h"
10 #include "chrome/browser/extensions/extension_tab_helper.h" 10 #include "chrome/browser/extensions/extension_tab_helper.h"
11 #include "chrome/browser/favicon/favicon_tab_helper.h" 11 #include "chrome/browser/favicon/favicon_tab_helper.h"
12 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
15 #include "chrome/browser/ui/web_applications/web_app_ui.h" 15 #include "chrome/browser/ui/web_applications/web_app_ui.h"
16 #include "chrome/browser/ui/webui/extension_icon_source.h"
16 #include "chrome/common/chrome_constants.h" 17 #include "chrome/common/chrome_constants.h"
17 #include "chrome/common/extensions/extension.h" 18 #include "chrome/common/extensions/extension.h"
18 #include "chrome/common/extensions/extension_resource.h" 19 #include "chrome/common/extensions/extension_resource.h"
19 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
20 #include "content/browser/tab_contents/tab_contents.h" 21 #include "content/browser/tab_contents/tab_contents.h"
21 #include "content/browser/tab_contents/tab_contents_delegate.h" 22 #include "content/browser/tab_contents/tab_contents_delegate.h"
22 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
23 #include "grit/locale_settings.h" 24 #include "grit/locale_settings.h"
25 #include "grit/theme_resources.h"
24 #include "net/base/load_flags.h" 26 #include "net/base/load_flags.h"
25 #include "net/url_request/url_request.h" 27 #include "net/url_request/url_request.h"
26 #include "third_party/skia/include/core/SkRect.h" 28 #include "third_party/skia/include/core/SkRect.h"
27 #include "third_party/skia/include/core/SkPaint.h" 29 #include "third_party/skia/include/core/SkPaint.h"
28 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
29 #include "ui/base/resource/resource_bundle.h" 31 #include "ui/base/resource/resource_bundle.h"
30 #include "ui/gfx/canvas_skia.h" 32 #include "ui/gfx/canvas_skia.h"
31 #include "ui/gfx/codec/png_codec.h" 33 #include "ui/gfx/codec/png_codec.h"
32 #include "views/controls/button/checkbox.h" 34 #include "views/controls/button/checkbox.h"
33 #include "views/controls/image_view.h" 35 #include "views/controls/image_view.h"
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 ImageLoadingTracker::DONT_CACHE); 515 ImageLoadingTracker::DONT_CACHE);
514 516
515 InitControls(); 517 InitControls();
516 } 518 }
517 519
518 CreateChromeApplicationShortcutView::~CreateChromeApplicationShortcutView() {} 520 CreateChromeApplicationShortcutView::~CreateChromeApplicationShortcutView() {}
519 521
520 // Called by tracker_ when the app's icon is loaded. 522 // Called by tracker_ when the app's icon is loaded.
521 void CreateChromeApplicationShortcutView::OnImageLoaded( 523 void CreateChromeApplicationShortcutView::OnImageLoaded(
522 SkBitmap* image, const ExtensionResource& resource, int index) { 524 SkBitmap* image, const ExtensionResource& resource, int index) {
523 if (image->isNull()) { 525 if (!image || image->isNull())
524 NOTREACHED() << "Corrupt image in profile?"; 526 image = ExtensionIconSource::LoadImageByResourceId(IDR_APP_DEFAULT_ICON);
525 return; 527
526 }
527 shortcut_info_.favicon = *image; 528 shortcut_info_.favicon = *image;
528 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); 529 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon);
529 } 530 }
530
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc ('k') | chrome/browser/ui/webui/extension_icon_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698