| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_TAB_MODAL_CONFIRM_DIALOG_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_TAB_MODAL_CONFIRM_DIALOG_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_TAB_MODAL_CONFIRM_DIALOG_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_TAB_MODAL_CONFIRM_DIALOG_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 protected: | 95 protected: |
| 96 TabModalConfirmDialogCloseDelegate* close_delegate() { | 96 TabModalConfirmDialogCloseDelegate* close_delegate() { |
| 97 return close_delegate_; | 97 return close_delegate_; |
| 98 } | 98 } |
| 99 | 99 |
| 100 // content::NotificationObserver implementation. | 100 // content::NotificationObserver implementation. |
| 101 // Watch for a new load or a closed tab and dismiss the dialog if they occur. | 101 // Watch for a new load or a closed tab and dismiss the dialog if they occur. |
| 102 virtual void Observe(int type, | 102 virtual void Observe(int type, |
| 103 const content::NotificationSource& source, | 103 const content::NotificationSource& source, |
| 104 const content::NotificationDetails& details) OVERRIDE; | 104 const content::NotificationDetails& details) override; |
| 105 | 105 |
| 106 content::NotificationRegistrar registrar_; | 106 content::NotificationRegistrar registrar_; |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 // It is guaranteed that exactly one of OnAccepted(), OnCanceled() or | 109 // It is guaranteed that exactly one of OnAccepted(), OnCanceled() or |
| 110 // OnClosed() is eventually called. These method are private to enforce this | 110 // OnClosed() is eventually called. These method are private to enforce this |
| 111 // guarantee. Access to them is controlled by Accept(), Cancel() and Close(). | 111 // guarantee. Access to them is controlled by Accept(), Cancel() and Close(). |
| 112 | 112 |
| 113 // Called when the user accepts or cancels the dialog, respectively. | 113 // Called when the user accepts or cancels the dialog, respectively. |
| 114 virtual void OnAccepted(); | 114 virtual void OnAccepted(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 129 TabModalConfirmDialogCloseDelegate* close_delegate_; | 129 TabModalConfirmDialogCloseDelegate* close_delegate_; |
| 130 | 130 |
| 131 // True iff we are in the process of closing, to avoid running callbacks | 131 // True iff we are in the process of closing, to avoid running callbacks |
| 132 // multiple times. | 132 // multiple times. |
| 133 bool closing_; | 133 bool closing_; |
| 134 | 134 |
| 135 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogDelegate); | 135 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogDelegate); |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 #endif // CHROME_BROWSER_UI_TAB_MODAL_CONFIRM_DIALOG_DELEGATE_H_ | 138 #endif // CHROME_BROWSER_UI_TAB_MODAL_CONFIRM_DIALOG_DELEGATE_H_ |
| OLD | NEW |