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

Unified Diff: components/app_modal/javascript_dialog_manager.cc

Issue 2412843002: Simplify the JavaScriptDialogManager. (Closed)
Patch Set: braces Created 4 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: components/app_modal/javascript_dialog_manager.cc
diff --git a/components/app_modal/javascript_dialog_manager.cc b/components/app_modal/javascript_dialog_manager.cc
index b6ee3395c99e4e90161a2d6a230f9f77d592856e..7628f213971b00f14c59ec058dd2c1b7dc228e99 100644
--- a/components/app_modal/javascript_dialog_manager.cc
+++ b/components/app_modal/javascript_dialog_manager.cc
@@ -241,12 +241,6 @@ bool JavaScriptDialogManager::HandleJavaScriptDialog(
return true;
}
-void JavaScriptDialogManager::ResetDialogState(
- content::WebContents* web_contents) {
- CancelActiveAndPendingDialogs(web_contents);
- javascript_dialog_extra_data_.erase(web_contents);
-}
-
base::string16 JavaScriptDialogManager::GetTitle(
content::WebContents* web_contents,
const GURL& origin_url,
@@ -281,8 +275,9 @@ base::string16 JavaScriptDialogManager::GetTitle(
: IDS_JAVASCRIPT_MESSAGEBOX_TITLE_NONSTANDARD_URL_IFRAME);
}
-void JavaScriptDialogManager::CancelActiveAndPendingDialogs(
- content::WebContents* web_contents) {
+void JavaScriptDialogManager::CancelDialogs(content::WebContents* web_contents,
+ bool suppress_callbacks,
+ bool reset_state) {
AppModalDialogQueue* queue = AppModalDialogQueue::GetInstance();
AppModalDialog* active_dialog = queue->active_dialog();
for (AppModalDialogQueue::iterator i = queue->begin();
@@ -292,10 +287,13 @@ void JavaScriptDialogManager::CancelActiveAndPendingDialogs(
if ((*i) == active_dialog)
continue;
if ((*i)->web_contents() == web_contents)
- (*i)->Invalidate();
+ (*i)->Invalidate(suppress_callbacks);
}
if (active_dialog && active_dialog->web_contents() == web_contents)
- active_dialog->Invalidate();
+ active_dialog->Invalidate(suppress_callbacks);
+
+ if (reset_state)
+ javascript_dialog_extra_data_.erase(web_contents);
}
void JavaScriptDialogManager::OnBeforeUnloadDialogClosed(
« no previous file with comments | « components/app_modal/javascript_dialog_manager.h ('k') | content/browser/devtools/protocol/devtools_protocol_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698