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

Unified Diff: chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc

Issue 697023002: Cancel uninstall if the uninstall dialog's parent window is destroyed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/ui/views/extensions/extension_uninstall_dialog_view.cc
diff --git a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
index ba25f8dc9707ad9983f9f7df06699139f67abb4d..061ba349185154333a484b098ebc4c308f7cecf7 100644
--- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
+++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
@@ -12,6 +12,7 @@
#include "chrome/grit/generated_resources.h"
#include "components/constrained_window/constrained_window_views.h"
#include "extensions/common/extension.h"
+#include "ui/aura/window_tracker.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/layer.h"
@@ -35,7 +36,7 @@ class ExtensionUninstallDialogViews
public:
ExtensionUninstallDialogViews(
Profile* profile,
- gfx::NativeWindow parent,
+ aura::Window* parent,
extensions::ExtensionUninstallDialog::Delegate* delegate);
~ExtensionUninstallDialogViews() override;
@@ -52,6 +53,12 @@ class ExtensionUninstallDialogViews
ExtensionUninstallDialogDelegateView* view_;
+ // The dialog's parent window.
+ aura::Window* parent_;
+
+ // Tracks whether |parent_| got destroyed.
+ aura::WindowTracker parent_window_tracker_;
+
DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallDialogViews);
};
@@ -100,10 +107,13 @@ class ExtensionUninstallDialogDelegateView : public views::DialogDelegateView {
ExtensionUninstallDialogViews::ExtensionUninstallDialogViews(
Profile* profile,
- gfx::NativeWindow parent,
+ aura::Window* parent,
extensions::ExtensionUninstallDialog::Delegate* delegate)
- : extensions::ExtensionUninstallDialog(profile, parent, delegate),
- view_(NULL) {
+ : extensions::ExtensionUninstallDialog(profile, delegate),
+ view_(NULL),
+ parent_(parent) {
+ if (parent_)
+ parent_window_tracker_.Add(parent_);
}
ExtensionUninstallDialogViews::~ExtensionUninstallDialogViews() {
@@ -115,6 +125,11 @@ ExtensionUninstallDialogViews::~ExtensionUninstallDialogViews() {
}
void ExtensionUninstallDialogViews::Show() {
+ if (parent_ && !parent_window_tracker_.Contains(parent_)) {
+ delegate_->ExtensionUninstallCanceled();
+ return;
+ }
+
view_ = new ExtensionUninstallDialogDelegateView(
this, extension_, triggering_extension_, &icon_);
CreateBrowserModalDialogViews(view_, parent_)->Show();

Powered by Google App Engine
This is Rietveld 408576698