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

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

Issue 683993002: Revert of 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 04cb12b4d8198da1750b0a01fb10f7c21d00c85e..d8667c651c3951a62d4ba2fbaa5f1293434d1486 100644
--- a/chrome/browser/extensions/extension_install_prompt.cc
+++ b/chrome/browser/extensions/extension_install_prompt.cc
@@ -14,7 +14,6 @@
#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"
@@ -176,6 +175,13 @@
return Profile::FromBrowserContext(web_contents->GetBrowserContext());
}
+gfx::NativeWindow NativeWindowForWebContents(content::WebContents* contents) {
+ if (!contents)
+ return NULL;
+
+ return contents->GetTopLevelNativeWindow();
+}
+
} // namespace
ExtensionInstallPrompt::Prompt::InstallPromptPermissions::
@@ -606,6 +612,19 @@
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(
@@ -644,7 +663,7 @@
bundle_(NULL),
install_ui_(extensions::CreateExtensionInstallUI(
ProfileForWebContents(contents))),
- show_params_(new ExtensionInstallPromptShowParams(contents)),
+ show_params_(contents),
delegate_(NULL) {
}
@@ -655,8 +674,7 @@
extension_(NULL),
bundle_(NULL),
install_ui_(extensions::CreateExtensionInstallUI(profile)),
- show_params_(
- new ExtensionInstallPromptShowParams(profile, native_window)),
+ show_params_(profile, native_window),
delegate_(NULL) {
}
@@ -926,13 +944,8 @@
if (AutoConfirmPrompt(delegate_))
return;
- if (show_params_->WasParentDestroyed()) {
- delegate_->InstallUIAbort(false);
- return;
- }
-
if (show_dialog_callback_.is_null())
- GetDefaultShowDialogCallback().Run(show_params_.get(), delegate_, prompt_);
+ GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_);
else
- show_dialog_callback_.Run(show_params_.get(), delegate_, prompt_);
-}
+ show_dialog_callback_.Run(show_params_, delegate_, prompt_);
+}

Powered by Google App Engine
This is Rietveld 408576698