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

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: 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..c67ac4ff5340123d332bd9c5231442f3179e64d1 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
@@ -714,14 +715,14 @@ int ExtensionInstallDialogView::GetDefaultDialogButton() const {
}
bool ExtensionInstallDialogView::Cancel() {
- UpdateInstallResultHistogram(false);
- if (sampling_event_.get())
- sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kDeny);
- delegate_->InstallUIAbort(true);
+ OnInstallAborted();
return true;
}
bool ExtensionInstallDialogView::Accept() {
+ DCHECK(!handled_result_);
+
+ handled_result_ = true;
UpdateInstallResultHistogram(true);
if (sampling_event_.get())
sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kProceed);
@@ -729,6 +730,12 @@ bool ExtensionInstallDialogView::Accept() {
return true;
}
+void ExtensionInstallDialogView::OnClosed() {
+ // The install dialog may have been closed without the user selecting accept
+ // or cancel, so ensure this case is treated as an abort.
+ OnInstallAborted();
+}
+
ui::ModalType ExtensionInstallDialogView::GetModalType() const {
return ui::MODAL_TYPE_WINDOW;
}
@@ -855,6 +862,17 @@ void ExtensionInstallDialogView::UpdateLinkActionHistogram(int action_type)
}
}
+void ExtensionInstallDialogView::OnInstallAborted() {
+ if (handled_result_)
+ return;
+
+ handled_result_ = true;
+ UpdateInstallResultHistogram(false);
+ if (sampling_event_.get())
tapted 2014/09/08 07:42:20 nit: pretty sure Chrome prefers dropping the `.get
tmdiep 2014/09/08 08:26:08 Done.
+ sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kDeny);
+ delegate_->InstallUIAbort(true);
+}
+
// ExpandableContainerView::DetailsView ----------------------------------------
ExpandableContainerView::DetailsView::DetailsView(int horizontal_space,

Powered by Google App Engine
This is Rietveld 408576698