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

Side by Side Diff: chrome/browser/ui/unload_controller.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_UNLOAD_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_UNLOAD_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_UNLOAD_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_UNLOAD_CONTROLLER_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 10 matching lines...) Expand all
21 class NotificationDetails; 21 class NotificationDetails;
22 class WebContents; 22 class WebContents;
23 } 23 }
24 24
25 namespace chrome { 25 namespace chrome {
26 26
27 class UnloadController : public content::NotificationObserver, 27 class UnloadController : public content::NotificationObserver,
28 public TabStripModelObserver { 28 public TabStripModelObserver {
29 public: 29 public:
30 explicit UnloadController(Browser* browser); 30 explicit UnloadController(Browser* browser);
31 virtual ~UnloadController(); 31 ~UnloadController() override;
32 32
33 // Returns true if |contents| can be cleanly closed. When |browser_| is being 33 // Returns true if |contents| can be cleanly closed. When |browser_| is being
34 // closed, this function will return false to indicate |contents| should not 34 // closed, this function will return false to indicate |contents| should not
35 // be cleanly closed, since the fast shutdown path will just kill its 35 // be cleanly closed, since the fast shutdown path will just kill its
36 // renderer. 36 // renderer.
37 bool CanCloseContents(content::WebContents* contents); 37 bool CanCloseContents(content::WebContents* contents);
38 38
39 // Returns true if we need to run unload events for the |contents|. 39 // Returns true if we need to run unload events for the |contents|.
40 static bool ShouldRunUnloadEventsHelper(content::WebContents* contents); 40 static bool ShouldRunUnloadEventsHelper(content::WebContents* contents);
41 41
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 bool TabsNeedBeforeUnloadFired(); 79 bool TabsNeedBeforeUnloadFired();
80 80
81 // Clears all the state associated with processing tabs' beforeunload/unload 81 // Clears all the state associated with processing tabs' beforeunload/unload
82 // events since the user cancelled closing the window. 82 // events since the user cancelled closing the window.
83 void CancelWindowClose(); 83 void CancelWindowClose();
84 84
85 private: 85 private:
86 typedef std::set<content::WebContents*> UnloadListenerSet; 86 typedef std::set<content::WebContents*> UnloadListenerSet;
87 87
88 // Overridden from content::NotificationObserver: 88 // Overridden from content::NotificationObserver:
89 virtual void Observe(int type, 89 void Observe(int type,
90 const content::NotificationSource& source, 90 const content::NotificationSource& source,
91 const content::NotificationDetails& details) override; 91 const content::NotificationDetails& details) override;
92 92
93 // Overridden from TabStripModelObserver: 93 // Overridden from TabStripModelObserver:
94 virtual void TabInsertedAt(content::WebContents* contents, 94 void TabInsertedAt(content::WebContents* contents,
95 int index, 95 int index,
96 bool foreground) override; 96 bool foreground) override;
97 virtual void TabDetachedAt(content::WebContents* contents, 97 void TabDetachedAt(content::WebContents* contents, int index) override;
98 int index) override; 98 void TabReplacedAt(TabStripModel* tab_strip_model,
99 virtual void TabReplacedAt(TabStripModel* tab_strip_model, 99 content::WebContents* old_contents,
100 content::WebContents* old_contents, 100 content::WebContents* new_contents,
101 content::WebContents* new_contents, 101 int index) override;
102 int index) override; 102 void TabStripEmpty() override;
103 virtual void TabStripEmpty() override;
104 103
105 void TabAttachedImpl(content::WebContents* contents); 104 void TabAttachedImpl(content::WebContents* contents);
106 void TabDetachedImpl(content::WebContents* contents); 105 void TabDetachedImpl(content::WebContents* contents);
107 106
108 // Processes the next tab that needs it's beforeunload/unload event fired. 107 // Processes the next tab that needs it's beforeunload/unload event fired.
109 void ProcessPendingTabs(); 108 void ProcessPendingTabs();
110 109
111 // Whether we've completed firing all the tabs' beforeunload/unload events. 110 // Whether we've completed firing all the tabs' beforeunload/unload events.
112 bool HasCompletedUnloadProcessing() const; 111 bool HasCompletedUnloadProcessing() const;
113 112
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 base::Callback<void(bool)> on_close_confirmed_; 154 base::Callback<void(bool)> on_close_confirmed_;
156 155
157 base::WeakPtrFactory<UnloadController> weak_factory_; 156 base::WeakPtrFactory<UnloadController> weak_factory_;
158 157
159 DISALLOW_COPY_AND_ASSIGN(UnloadController); 158 DISALLOW_COPY_AND_ASSIGN(UnloadController);
160 }; 159 };
161 160
162 } // namespace chrome 161 } // namespace chrome
163 162
164 #endif // CHROME_BROWSER_UI_UNLOAD_CONTROLLER_H_ 163 #endif // CHROME_BROWSER_UI_UNLOAD_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698