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

Unified Diff: chrome/browser/extensions/extension_install_prompt.cc

Issue 662073002: Fix crash when user closes window prior to the "Confirm Install" prompt showing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/install_prompt_navigator
Patch Set: Created 6 years, 2 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/extensions/extension_install_prompt.cc
diff --git a/chrome/browser/extensions/extension_install_prompt.cc b/chrome/browser/extensions/extension_install_prompt.cc
index d8667c651c3951a62d4ba2fbaa5f1293434d1486..04cb12b4d8198da1750b0a01fb10f7c21d00c85e 100644
--- a/chrome/browser/extensions/extension_install_prompt.cc
+++ b/chrome/browser/extensions/extension_install_prompt.cc
@@ -14,6 +14,7 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/extensions/bundle_installer.h"
+#include "chrome/browser/extensions/extension_install_prompt_show_params.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/permissions_updater.h"
#include "chrome/browser/profiles/profile.h"
@@ -175,13 +176,6 @@ Profile* ProfileForWebContents(content::WebContents* web_contents) {
return Profile::FromBrowserContext(web_contents->GetBrowserContext());
}
-gfx::NativeWindow NativeWindowForWebContents(content::WebContents* contents) {
- if (!contents)
- return NULL;
-
- return contents->GetTopLevelNativeWindow();
-}
-
} // namespace
ExtensionInstallPrompt::Prompt::InstallPromptPermissions::
@@ -612,19 +606,6 @@ bool ExtensionInstallPrompt::Prompt::ShouldDisplayRevokeFilesButton() const {
return !retained_files_.empty();
}
-ExtensionInstallPrompt::ShowParams::ShowParams(content::WebContents* contents)
- : profile(ProfileForWebContents(contents)),
- parent_web_contents(contents),
- parent_window(NativeWindowForWebContents(contents)) {
-}
-
-ExtensionInstallPrompt::ShowParams::ShowParams(Profile* profile,
- gfx::NativeWindow window)
- : profile(profile),
- parent_web_contents(NULL),
- parent_window(window) {
-}
-
// static
scoped_refptr<Extension>
ExtensionInstallPrompt::GetLocalizedExtensionForDisplay(
@@ -663,7 +644,7 @@ ExtensionInstallPrompt::ExtensionInstallPrompt(content::WebContents* contents)
bundle_(NULL),
install_ui_(extensions::CreateExtensionInstallUI(
ProfileForWebContents(contents))),
- show_params_(contents),
+ show_params_(new ExtensionInstallPromptShowParams(contents)),
delegate_(NULL) {
}
@@ -674,7 +655,8 @@ ExtensionInstallPrompt::ExtensionInstallPrompt(Profile* profile,
extension_(NULL),
bundle_(NULL),
install_ui_(extensions::CreateExtensionInstallUI(profile)),
- show_params_(profile, native_window),
+ show_params_(
+ new ExtensionInstallPromptShowParams(profile, native_window)),
delegate_(NULL) {
}
@@ -944,8 +926,13 @@ void ExtensionInstallPrompt::ShowConfirmation() {
if (AutoConfirmPrompt(delegate_))
return;
+ if (show_params_->WasParentDestroyed()) {
+ delegate_->InstallUIAbort(false);
+ return;
+ }
+
if (show_dialog_callback_.is_null())
- GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_);
+ GetDefaultShowDialogCallback().Run(show_params_.get(), delegate_, prompt_);
else
- show_dialog_callback_.Run(show_params_, delegate_, prompt_);
+ show_dialog_callback_.Run(show_params_.get(), delegate_, prompt_);
}

Powered by Google App Engine
This is Rietveld 408576698