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..2c8c797ef0df4a8f02b1b8b5f83b0097913d578e 100644 |
--- a/chrome/browser/extensions/extension_uninstall_dialog.cc |
+++ b/chrome/browser/extensions/extension_uninstall_dialog.cc |
@@ -45,20 +45,26 @@ 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)); |
- } |
+} |
+ |
+void ExtensionUninstallDialog::RegisterObserver(Browser* browser) { |
sashab
2014/07/21 02:50:30
We can actually remove the need for the Browser ob
|
+ // Close the dialog if the browser is closed while the dialog is open. |
+ registrar_.Add(this, |
+ chrome::NOTIFICATION_BROWSER_CLOSED, |
+ content::Source<Browser>(browser)); |
+ |
+ // If there are no open browser windows, close the dialog immediately. |
+ if (!browser->window()) |
+ delegate_->ExtensionUninstallCanceled(); |
} |
ExtensionUninstallDialog::~ExtensionUninstallDialog() { |
@@ -139,7 +145,6 @@ void ExtensionUninstallDialog::Observe( |
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. |