Chromium Code Reviews| 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 467a3527b11b99d384404b7a171afa0ac6acecfd..96c628e1283f87e17dd4b09b330d78563631c9d5 100644 |
| --- a/chrome/browser/extensions/extension_uninstall_dialog.cc |
| +++ b/chrome/browser/extensions/extension_uninstall_dialog.cc |
| @@ -45,20 +45,14 @@ SkBitmap GetDefaultIconBitmapForMaxScaleFactor(bool is_app) { |
| ExtensionUninstallDialog::ExtensionUninstallDialog( |
| Profile* profile, |
| - Browser* browser, |
| + gfx::NativeWindow parent, |
| ExtensionUninstallDialog::Delegate* delegate) |
| : profile_(profile), |
| - browser_(browser), |
| + parent_(parent), |
| delegate_(delegate), |
| extension_(NULL), |
| triggering_extension_(NULL), |
| - state_(kImageIsLoading), |
| ui_loop_(base::MessageLoop::current()) { |
| - if (browser) { |
| - registrar_.Add(this, |
| - chrome::NOTIFICATION_BROWSER_CLOSED, |
| - content::Source<Browser>(browser)); |
| - } |
| } |
| ExtensionUninstallDialog::~ExtensionUninstallDialog() { |
| @@ -82,9 +76,9 @@ void ExtensionUninstallDialog::ConfirmUninstall(const Extension* extension) { |
| extension_, icon_size, ExtensionIconSet::MATCH_BIGGER); |
| // Load the image asynchronously. The response will be sent to OnImageLoaded. |
| - state_ = kImageIsLoading; |
| ImageLoader* loader = ImageLoader::Get(profile_); |
| + SetIcon(gfx::Image()); |
| std::vector<ImageLoader::ImageRepresentation> images_list; |
| images_list.push_back(ImageLoader::ImageRepresentation( |
| image, |
| @@ -96,6 +90,7 @@ void ExtensionUninstallDialog::ConfirmUninstall(const Extension* extension) { |
| base::Bind(&ExtensionUninstallDialog::OnImageLoaded, |
| AsWeakPtr(), |
| extension_->id())); |
| + Show(); |
| } |
| void ExtensionUninstallDialog::SetIcon(const gfx::Image& image) { |
| @@ -123,30 +118,7 @@ void ExtensionUninstallDialog::OnImageLoaded(const std::string& extension_id, |
| } |
| SetIcon(image); |
| - |
| - // Show the dialog unless the browser has been closed while we were waiting |
| - // for the image. |
| - DCHECK(state_ == kImageIsLoading || state_ == kBrowserIsClosing); |
| - if (state_ == kImageIsLoading) { |
| - state_ = kDialogIsShowing; |
| - Show(); |
| - } |
| -} |
| - |
| -void ExtensionUninstallDialog::Observe( |
| - int type, |
| - const content::NotificationSource& source, |
| - const content::NotificationDetails& details) { |
| - DCHECK(type == chrome::NOTIFICATION_BROWSER_CLOSED); |
| - |
| - browser_ = NULL; |
| - // If the browser is closed while waiting for the image, we need to send a |
| - // "cancel" event here, because there will not be another opportunity to |
| - // notify the delegate of the cancellation as we won't open the dialog. |
| - if (state_ == kImageIsLoading) { |
| - state_ = kBrowserIsClosing; |
| - delegate_->ExtensionUninstallCanceled(); |
| - } |
| + RefreshIcon(); |
|
tapted
2014/07/24 00:35:36
I think you can just move the `Show()` down here,
sashab
2014/07/24 03:03:35
Done. The original reason I did it this way was to
|
| } |
| std::string ExtensionUninstallDialog::GetHeadingText() { |