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

Side by Side Diff: chrome/browser/ui/tab_modal_confirm_dialog_delegate.h

Issue 671653002: Standardize usage of virtual/override/final in chrome/browser/ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
OLDNEW
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 18 matching lines...) Expand all
29 29
30 private: 30 private:
31 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogCloseDelegate); 31 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogCloseDelegate);
32 }; 32 };
33 33
34 // This class acts as the delegate for a simple tab-modal dialog confirming 34 // This class acts as the delegate for a simple tab-modal dialog confirming
35 // whether the user wants to execute a certain action. 35 // whether the user wants to execute a certain action.
36 class TabModalConfirmDialogDelegate : public content::NotificationObserver { 36 class TabModalConfirmDialogDelegate : public content::NotificationObserver {
37 public: 37 public:
38 explicit TabModalConfirmDialogDelegate(content::WebContents* web_contents); 38 explicit TabModalConfirmDialogDelegate(content::WebContents* web_contents);
39 virtual ~TabModalConfirmDialogDelegate(); 39 ~TabModalConfirmDialogDelegate() override;
40 40
41 void set_close_delegate(TabModalConfirmDialogCloseDelegate* close_delegate) { 41 void set_close_delegate(TabModalConfirmDialogCloseDelegate* close_delegate) {
42 close_delegate_ = close_delegate; 42 close_delegate_ = close_delegate;
43 } 43 }
44 44
45 // Accepts the confirmation prompt and calls OnAccepted() if no other call 45 // Accepts the confirmation prompt and calls OnAccepted() if no other call
46 // to Accept(), Cancel() or Close() has been made before. 46 // to Accept(), Cancel() or Close() has been made before.
47 // This method is safe to call even from an OnAccepted(), OnCanceled(), 47 // This method is safe to call even from an OnAccepted(), OnCanceled(),
48 // OnClosed() or OnLinkClicked() callback. 48 // OnClosed() or OnLinkClicked() callback.
49 void Accept(); 49 void Accept();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 virtual const char* GetAcceptButtonIcon(); 92 virtual const char* GetAcceptButtonIcon();
93 virtual const char* GetCancelButtonIcon(); 93 virtual const char* GetCancelButtonIcon();
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 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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698