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

Unified Diff: chrome/browser/extensions/extension_uninstall_dialog.cc

Issue 7920023: Fix crashes related to the extension uninstall dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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/extensions/extension_uninstall_dialog.cc
diff --git a/chrome/browser/extensions/extension_uninstall_dialog.cc b/chrome/browser/extensions/extension_uninstall_dialog.cc
index ef1e3bcfd86b3600d2add5f238b49094c080bbb2..cb17eea31dddc5368aa2dcc62422f8e23ccee323 100644
--- a/chrome/browser/extensions/extension_uninstall_dialog.cc
+++ b/chrome/browser/extensions/extension_uninstall_dialog.cc
@@ -4,65 +4,14 @@
#include "chrome/browser/extensions/extension_uninstall_dialog.h"
-#include "base/logging.h"
-#include "base/message_loop.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/extensions/extension.h"
-#include "chrome/common/extensions/extension_icon_set.h"
-#include "chrome/common/extensions/extension_resource.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "ui/base/resource/resource_bundle.h"
-
-// Size of extension icon in top left of dialog.
-static const int kIconSize = 69;
-
-ExtensionUninstallDialog::ExtensionUninstallDialog(Profile* profile)
+ExtensionUninstallDialog::ExtensionUninstallDialog(
+ Profile* profile,
+ ExtensionUninstallUI::Delegate* delegate,
+ const Extension* extension,
+ SkBitmap* icon)
: profile_(profile),
- ui_loop_(MessageLoop::current()),
- delegate_(NULL),
- extension_(NULL),
- ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) {
-}
-
-ExtensionUninstallDialog::~ExtensionUninstallDialog() {
-}
-
-void ExtensionUninstallDialog::ConfirmUninstall(Delegate* delegate,
- const Extension* extension) {
- DCHECK(ui_loop_ == MessageLoop::current());
- delegate_ = delegate;
- extension_ = extension;
-
- ExtensionResource image =
- extension_->GetIconResource(Extension::EXTENSION_ICON_LARGE,
- ExtensionIconSet::MATCH_EXACTLY);
- // Load the image asynchronously. The response will be sent to OnImageLoaded.
- tracker_.LoadImage(extension_, image,
- gfx::Size(kIconSize, kIconSize),
- ImageLoadingTracker::DONT_CACHE);
-}
-
-void ExtensionUninstallDialog::SetIcon(SkBitmap* image) {
- if (image)
- icon_ = *image;
- else
- icon_ = SkBitmap();
- if (icon_.empty()) {
- if (extension_->is_app()) {
- icon_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed(
- IDR_APP_DEFAULT_ICON);
- } else {
- icon_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed(
- IDR_EXTENSION_DEFAULT_ICON);
- }
- }
-}
-
-void ExtensionUninstallDialog::OnImageLoaded(SkBitmap* image,
- const ExtensionResource& resource,
- int index) {
- SetIcon(image);
+ delegate_(delegate),
+ extension_(extension),
+ icon_(icon) {}
- Show(profile_, delegate_, extension_, &icon_);
-}
+ExtensionUninstallDialog::~ExtensionUninstallDialog() {}

Powered by Google App Engine
This is Rietveld 408576698