Index: chrome/browser/ui/tab_modal_confirm_dialog_delegate.h |
diff --git a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h |
index e58e00de741d07fa327d4454c9805013b60f5830..03ca583cee890767e2cf969f038be39edf7225fb 100644 |
--- a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h |
+++ b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h |
@@ -42,20 +42,34 @@ class TabModalConfirmDialogDelegate : public content::NotificationObserver { |
close_delegate_ = close_delegate; |
} |
- // Accepts the confirmation prompt and calls |OnAccepted|. |
+ // Accepts the confirmation prompt and calls |OnAccepted| if no other call |
+ // to |Accept|, |Cancel|, |LinkClicked| or |Dismissed| has been made before. |
// This method is safe to call even from an |OnAccepted| or |OnCanceled| |
// callback. |
- void Accept(); |
+ // Returns true if |OnAccepted| has been called, false otherwise. |
+ bool Accept(); |
fdoray
2013/06/28 15:32:59
Changing the return value is helpful to avoid mult
|
- // Cancels the confirmation prompt and calls |OnCanceled|. |
+ // Cancels the confirmation prompt and calls |OnCanceled| if no other call |
+ // to |Accept|, |Cancel|, |LinkClicked| or |Dismissed| has been made before. |
// This method is safe to call even from an |OnAccepted| or |OnCanceled| |
// callback. |
- void Cancel(); |
+ // Returns true if |OnCanceled| has been called, false otherwise. |
+ bool Cancel(); |
// Called when the link (if any) is clicked. Calls |OnLinkClicked| and closes |
- // the dialog. The |disposition| specifies how the resulting document should |
- // be loaded (based on the event flags present when the link was clicked). |
- void LinkClicked(WindowOpenDisposition disposition); |
+ // the dialog if no other call to |Accept|, |Cancel|, |LinkClicked| or |
+ // |Dismissed| has been made before. The |disposition| specifies how the |
+ // resulting document should be loaded (based on the event flags present when |
+ // the link was clicked). |
+ // Returns true if |OnLinkClicked| has been called, false otherwise. |
+ bool LinkClicked(WindowOpenDisposition disposition); |
+ |
+ // Called when the dialog is dismissed (by clicking on the Close button, |
+ // closing the parent tab or navigating to another page in the parent tab). |
+ // Calls |OnDismissed| and closes the dialog if no other call to |Accept|, |
+ // |Cancel|, |LinkClicked| or |Dismissed| has been made before. |
+ // Returns true if |OnDismissed| has been called, false otherwise. |
+ bool Dismissed(); |
// The title of the dialog. Note that the title is not shown on all platforms. |
virtual string16 GetTitle() = 0; |
@@ -94,10 +108,9 @@ class TabModalConfirmDialogDelegate : public content::NotificationObserver { |
content::NotificationRegistrar registrar_; |
private: |
- // It is guaranteed that exactly one of |OnAccepted|, |OnCanceled| or |
- // |OnLinkClicked| is eventually called. These method are private to |
- // enforce this guarantee. Access to them is controlled by |Accept|, |
- // |Cancel| and |LinkClicked|. |
+ // It is guaranteed that exactly one of the |On...| methods is eventually |
+ // called. These method are private to enforce this guarantee. Access to them |
+ // is controlled by |Accept|, |Cancel|, |LinkClicked| and |Dismissed|. |
// Called when the user accepts or cancels the dialog, respectively. |
virtual void OnAccepted(); |
@@ -106,6 +119,9 @@ class TabModalConfirmDialogDelegate : public content::NotificationObserver { |
// Called when the user clicks on the link (if any). |
virtual void OnLinkClicked(WindowOpenDisposition disposition); |
+ // Called when the dialog is dismissed. |
+ virtual void OnDismissed(); |
+ |
// Close the dialog. |
void CloseDialog(); |