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

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

Issue 547253002: Ensure app install is aborted when the install dialog is closed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Lower risk fix Created 6 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/ui/views/extensions/extension_install_dialog_view.cc
diff --git a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
index 674b3ae0842679d6de9e3d726ba6d85bc8a4d5f0..4ceb8cccee3ea4ba6cf95b4f4e5ebb5b178f12aa 100644
--- a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
+++ b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
@@ -195,7 +195,8 @@ ExtensionInstallDialogView::ExtensionInstallDialogView(
scrollable_header_only_(NULL),
show_details_link_(NULL),
checkbox_info_label_(NULL),
- unchecked_boxes_(0) {
+ unchecked_boxes_(0),
+ handled_result_(false) {
// Possible grid layouts without ExtensionPermissionDialog experiment:
// Inline install
// w/ permissions no permissions
@@ -588,7 +589,10 @@ ExtensionInstallDialogView::ExtensionInstallDialogView(
sampling_event_ = ExperienceSamplingEvent::Create(event_name);
}
-ExtensionInstallDialogView::~ExtensionInstallDialogView() {}
+ExtensionInstallDialogView::~ExtensionInstallDialogView() {
+ if (!handled_result_)
+ delegate_->InstallUIAbort(true);
+}
views::GridLayout* ExtensionInstallDialogView::CreateLayout(
views::View* parent,
@@ -714,16 +718,23 @@ int ExtensionInstallDialogView::GetDefaultDialogButton() const {
}
bool ExtensionInstallDialogView::Cancel() {
+ if (handled_result_)
+ return true;
+
+ handled_result_ = true;
UpdateInstallResultHistogram(false);
- if (sampling_event_.get())
+ if (sampling_event_)
sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kDeny);
delegate_->InstallUIAbort(true);
return true;
}
bool ExtensionInstallDialogView::Accept() {
+ DCHECK(!handled_result_);
+
+ handled_result_ = true;
UpdateInstallResultHistogram(true);
- if (sampling_event_.get())
+ if (sampling_event_)
sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kProceed);
delegate_->InstallUIProceed();
return true;

Powered by Google App Engine
This is Rietveld 408576698