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

Unified Diff: chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc

Issue 2846363004: Make extension callbacks with auto-dismissing dialogs (Closed)
Patch Set: reupload; no code change Created 3 years, 8 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/javascript_dialogs/javascript_dialog_tab_helper.cc
diff --git a/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc b/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc
index 76ac346a9786cbd6c6369d1357373f1ed4366985..bc80b47811da3d9c40c6502dda5dcd6169a3bc79 100644
--- a/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc
+++ b/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/ui/tab_modal_confirm_dialog.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_features.h"
+#include "components/app_modal/javascript_dialog_extensions_client.h"
#include "components/app_modal/javascript_dialog_manager.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
@@ -171,6 +172,9 @@ void JavaScriptDialogTabHelper::RunJavaScriptDialog(
AppModalDialogManager()->GetTitle(alerting_web_contents, origin_url);
dialog_callback_ = callback;
dialog_type_ = dialog_type;
+ alerting_web_contents_ = alerting_web_contents;
+ AppModalDialogManager()->GetExtensionsClient()->OnDialogOpened(
+ alerting_web_contents);
dialog_ = JavaScriptDialog::Create(
parent_web_contents, alerting_web_contents, title, dialog_type,
truncated_message_text, truncated_default_prompt_text,
@@ -330,6 +334,8 @@ void JavaScriptDialogTabHelper::OnDialogClosed(
const base::string16& user_input) {
LogDialogDismissalCause(DismissalCause::DIALOG_BUTTON_CLICKED);
callback.Run(success, user_input);
+ AppModalDialogManager()->GetExtensionsClient()->OnDialogClosed(
+ alerting_web_contents_);
ClearDialogInfo();
}
@@ -342,6 +348,8 @@ void JavaScriptDialogTabHelper::CloseDialog(bool success,
dialog_->CloseDialogWithoutCallback();
dialog_callback_.Run(success, user_input);
+ AppModalDialogManager()->GetExtensionsClient()->OnDialogClosed(
+ alerting_web_contents_);
ClearDialogInfo();
}
@@ -349,5 +357,6 @@ void JavaScriptDialogTabHelper::CloseDialog(bool success,
void JavaScriptDialogTabHelper::ClearDialogInfo() {
dialog_.reset();
dialog_callback_.Reset();
+ alerting_web_contents_ = nullptr;
BrowserList::RemoveObserver(this);
}
« no previous file with comments | « chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h ('k') | components/app_modal/javascript_dialog_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698