| 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/extensions/extension_uninstall_dialog.h" | 5 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "chrome/common/chrome_notification_types.h" | 9 #include "chrome/common/chrome_notification_types.h" |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
| 11 #include "chrome/common/extensions/extension_constants.h" |
| 11 #include "chrome/common/extensions/extension_icon_set.h" | 12 #include "chrome/common/extensions/extension_icon_set.h" |
| 12 #include "chrome/common/extensions/extension_resource.h" | 13 #include "chrome/common/extensions/extension_resource.h" |
| 13 #include "content/public/browser/notification_service.h" | 14 #include "content/public/browser/notification_service.h" |
| 14 #include "content/public/browser/notification_source.h" | 15 #include "content/public/browser/notification_source.h" |
| 15 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
| 16 #include "grit/theme_resources.h" | 17 #include "grit/theme_resources.h" |
| 17 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
| 18 #include "ui/gfx/image/image.h" | 19 #include "ui/gfx/image/image.h" |
| 19 | 20 |
| 20 // Size of extension icon in top left of dialog. | 21 // Size of extension icon in top left of dialog. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 36 | 37 |
| 37 ExtensionUninstallDialog::~ExtensionUninstallDialog() { | 38 ExtensionUninstallDialog::~ExtensionUninstallDialog() { |
| 38 } | 39 } |
| 39 | 40 |
| 40 void ExtensionUninstallDialog::ConfirmUninstall( | 41 void ExtensionUninstallDialog::ConfirmUninstall( |
| 41 const extensions::Extension* extension) { | 42 const extensions::Extension* extension) { |
| 42 DCHECK(ui_loop_ == MessageLoop::current()); | 43 DCHECK(ui_loop_ == MessageLoop::current()); |
| 43 extension_ = extension; | 44 extension_ = extension; |
| 44 | 45 |
| 45 ExtensionResource image = | 46 ExtensionResource image = |
| 46 extension_->GetIconResource(ExtensionIconSet::EXTENSION_ICON_LARGE, | 47 extension_->GetIconResource(extension_misc::EXTENSION_ICON_LARGE, |
| 47 ExtensionIconSet::MATCH_BIGGER); | 48 ExtensionIconSet::MATCH_BIGGER); |
| 48 // Load the image asynchronously. The response will be sent to OnImageLoaded. | 49 // Load the image asynchronously. The response will be sent to OnImageLoaded. |
| 49 tracker_.reset(new ImageLoadingTracker(this)); | 50 tracker_.reset(new ImageLoadingTracker(this)); |
| 50 tracker_->LoadImage(extension_, image, | 51 tracker_->LoadImage(extension_, image, |
| 51 gfx::Size(kIconSize, kIconSize), | 52 gfx::Size(kIconSize, kIconSize), |
| 52 ImageLoadingTracker::DONT_CACHE); | 53 ImageLoadingTracker::DONT_CACHE); |
| 53 } | 54 } |
| 54 | 55 |
| 55 void ExtensionUninstallDialog::SetIcon(const gfx::Image& image) { | 56 void ExtensionUninstallDialog::SetIcon(const gfx::Image& image) { |
| 56 if (image.IsEmpty()) { | 57 if (image.IsEmpty()) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 85 DCHECK(type == chrome::NOTIFICATION_BROWSER_CLOSING); | 86 DCHECK(type == chrome::NOTIFICATION_BROWSER_CLOSING); |
| 86 | 87 |
| 87 browser_ = NULL; | 88 browser_ = NULL; |
| 88 if (tracker_.get()) { | 89 if (tracker_.get()) { |
| 89 // If we're waiting for the icon, stop doing so because we're not going to | 90 // If we're waiting for the icon, stop doing so because we're not going to |
| 90 // show the dialog. | 91 // show the dialog. |
| 91 tracker_.reset(); | 92 tracker_.reset(); |
| 92 delegate_->ExtensionUninstallCanceled(); | 93 delegate_->ExtensionUninstallCanceled(); |
| 93 } | 94 } |
| 94 } | 95 } |
| OLD | NEW |