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

Unified Diff: chrome/browser/ui/webui/extensions/extension_loader_handler.cc

Issue 772983002: Fix a crash on clicking "Load unpacked extension" multiple times (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/extensions/extension_loader_handler.cc
diff --git a/chrome/browser/ui/webui/extensions/extension_loader_handler.cc b/chrome/browser/ui/webui/extensions/extension_loader_handler.cc
index bf47de246f8be327b89911bc87f8832bb9da1387..ccf7045fe4b6d494259eb7c7bf4afb350184864f 100644
--- a/chrome/browser/ui/webui/extensions/extension_loader_handler.cc
+++ b/chrome/browser/ui/webui/extensions/extension_loader_handler.cc
@@ -99,11 +99,16 @@ void ExtensionLoaderHandler::FileHelper::ChooseFile() {
static const ui::SelectFileDialog::Type kSelectType =
ui::SelectFileDialog::SELECT_FOLDER;
+ gfx::NativeWindow parent_window =
+ loader_handler_->web_ui()->GetWebContents()->GetTopLevelNativeWindow();
if (!load_extension_dialog_.get()) {
load_extension_dialog_ = ui::SelectFileDialog::Create(
this,
new ChromeSelectFilePolicy(
loader_handler_->web_ui()->GetWebContents()));
+ } else if (load_extension_dialog_->IsRunning(parent_window)) {
+ // File chooser dialog is already running; ignore the click.
+ return;
}
load_extension_dialog_->SelectFile(
@@ -113,7 +118,7 @@ void ExtensionLoaderHandler::FileHelper::ChooseFile() {
NULL,
kFileTypeIndex,
base::FilePath::StringType(),
- loader_handler_->web_ui()->GetWebContents()->GetTopLevelNativeWindow(),
+ parent_window,
NULL);
content::RecordComputedAction("Options_LoadUnpackedExtension");
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698