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

Side by Side Diff: chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h

Issue 2641173004: Make the callback from JavaScript dialogs even when closing a WebContents. (Closed)
Patch Set: fix Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_
6 #define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ 6 #define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 enum class DismissalCause; 72 enum class DismissalCause;
73 73
74 void LogDialogDismissalCause(DismissalCause cause); 74 void LogDialogDismissalCause(DismissalCause cause);
75 75
76 // Wrapper around a DialogClosedCallback so that we can intercept it before 76 // Wrapper around a DialogClosedCallback so that we can intercept it before
77 // passing it onto the original callback. 77 // passing it onto the original callback.
78 void OnDialogClosed(DialogClosedCallback callback, 78 void OnDialogClosed(DialogClosedCallback callback,
79 bool success, 79 bool success,
80 const base::string16& user_input); 80 const base::string16& user_input);
81 81
82 void CloseDialog(bool suppress_callback, 82 void CloseDialog(bool success,
83 bool success,
84 const base::string16& user_input, 83 const base::string16& user_input,
85 DismissalCause cause); 84 DismissalCause cause);
86 85
87 void ClearDialogInfo(); 86 void ClearDialogInfo();
88 87
89 // The dialog being displayed on the observed WebContents. 88 // The dialog being displayed on the observed WebContents.
90 base::WeakPtr<JavaScriptDialog> dialog_; 89 base::WeakPtr<JavaScriptDialog> dialog_;
91 90
92 // The type of dialog being displayed. Only valid when |dialog_| is non-null. 91 // The type of dialog being displayed. Only valid when |dialog_| is non-null.
93 content::JavaScriptMessageType message_type_ = 92 content::JavaScriptMessageType message_type_ =
94 content::JavaScriptMessageType::JAVASCRIPT_MESSAGE_TYPE_ALERT; 93 content::JavaScriptMessageType::JAVASCRIPT_MESSAGE_TYPE_ALERT;
95 94
96 // The callback provided for when the dialog is closed. Usually the dialog 95 // The callback provided for when the dialog is closed. Usually the dialog
97 // itself calls it, but in the cases where the dialog is closed not by the 96 // itself calls it, but in the cases where the dialog is closed not by the
98 // user's input but by a call to |CloseDialog|, this class will call it. 97 // user's input but by a call to |CloseDialog|, this class will call it.
99 content::JavaScriptDialogManager::DialogClosedCallback dialog_callback_; 98 content::JavaScriptDialogManager::DialogClosedCallback dialog_callback_;
100 99
101 base::Closure dialog_shown_; 100 base::Closure dialog_shown_;
102 101
103 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogTabHelper); 102 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogTabHelper);
104 }; 103 };
105 104
106 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ 105 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698