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

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

Issue 160963002: Reset UnloadController::is_attempting_to_close_browser_ when the download-in-progress prompt is can… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: IsFastTabUnloadEnabled Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_FAST_UNLOAD_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_FAST_UNLOAD_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_FAST_UNLOAD_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_FAST_UNLOAD_CONTROLLER_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // of tabs that need their BeforeUnloadHandlers fired. 102 // of tabs that need their BeforeUnloadHandlers fired.
103 // TODO(beng): This seems like it could be private but it is used by 103 // TODO(beng): This seems like it could be private but it is used by
104 // AreAllBrowsersCloseable() in application_lifetime.cc. It seems 104 // AreAllBrowsersCloseable() in application_lifetime.cc. It seems
105 // very similar to ShouldCloseWindow() and some consolidation 105 // very similar to ShouldCloseWindow() and some consolidation
106 // could be pursued. 106 // could be pursued.
107 bool TabsNeedBeforeUnloadFired(); 107 bool TabsNeedBeforeUnloadFired();
108 108
109 // Returns true if all tabs' beforeunload/unload events have fired. 109 // Returns true if all tabs' beforeunload/unload events have fired.
110 bool HasCompletedUnloadProcessing() const; 110 bool HasCompletedUnloadProcessing() const;
111 111
112 // Clears all the state associated with processing tabs' beforeunload/unload
113 // events since the user cancelled closing the window.
114 void CancelWindowClose();
sky 2014/02/18 21:24:00 move implementations to match.
benjhayden 2014/02/18 22:11:34 Done.
115
112 private: 116 private:
113 // Overridden from content::NotificationObserver: 117 // Overridden from content::NotificationObserver:
114 virtual void Observe(int type, 118 virtual void Observe(int type,
115 const content::NotificationSource& source, 119 const content::NotificationSource& source,
116 const content::NotificationDetails& details) OVERRIDE; 120 const content::NotificationDetails& details) OVERRIDE;
117 121
118 // Overridden from TabStripModelObserver: 122 // Overridden from TabStripModelObserver:
119 virtual void TabInsertedAt(content::WebContents* contents, 123 virtual void TabInsertedAt(content::WebContents* contents,
120 int index, 124 int index,
121 bool foreground) OVERRIDE; 125 bool foreground) OVERRIDE;
122 virtual void TabDetachedAt(content::WebContents* contents, 126 virtual void TabDetachedAt(content::WebContents* contents,
123 int index) OVERRIDE; 127 int index) OVERRIDE;
124 virtual void TabReplacedAt(TabStripModel* tab_strip_model, 128 virtual void TabReplacedAt(TabStripModel* tab_strip_model,
125 content::WebContents* old_contents, 129 content::WebContents* old_contents,
126 content::WebContents* new_contents, 130 content::WebContents* new_contents,
127 int index) OVERRIDE; 131 int index) OVERRIDE;
128 virtual void TabStripEmpty() OVERRIDE; 132 virtual void TabStripEmpty() OVERRIDE;
129 133
130 void TabAttachedImpl(content::WebContents* contents); 134 void TabAttachedImpl(content::WebContents* contents);
131 void TabDetachedImpl(content::WebContents* contents); 135 void TabDetachedImpl(content::WebContents* contents);
132 136
133 // Detach |contents| and wait for it to finish closing. 137 // Detach |contents| and wait for it to finish closing.
134 // The close must be inititiated outside of this method. 138 // The close must be inititiated outside of this method.
135 // Returns true if it succeeds. 139 // Returns true if it succeeds.
136 bool DetachWebContents(content::WebContents* contents); 140 bool DetachWebContents(content::WebContents* contents);
137 141
138 // Processes the next tab that needs it's beforeunload/unload event fired. 142 // Processes the next tab that needs it's beforeunload/unload event fired.
139 void ProcessPendingTabs(); 143 void ProcessPendingTabs();
140 144
141 // Clears all the state associated with processing tabs' beforeunload/unload
142 // events since the user cancelled closing the window.
143 void CancelWindowClose();
144
145 // Cleans up state appropriately when we are trying to close the 145 // Cleans up state appropriately when we are trying to close the
146 // browser or close a tab in the background. We also use this in the 146 // browser or close a tab in the background. We also use this in the
147 // cases where a tab crashes or hangs even if the 147 // cases where a tab crashes or hangs even if the
148 // beforeunload/unload haven't successfully fired. 148 // beforeunload/unload haven't successfully fired.
149 void ClearUnloadState(content::WebContents* contents); 149 void ClearUnloadState(content::WebContents* contents);
150 150
151 // Helper for |ClearUnloadState| to unwind stack before proceeding. 151 // Helper for |ClearUnloadState| to unwind stack before proceeding.
152 void PostTaskForProcessPendingTabs(); 152 void PostTaskForProcessPendingTabs();
153 153
154 // Log a step of the unload processing. 154 // Log a step of the unload processing.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 scoped_ptr<DetachedWebContentsDelegate> detached_delegate_; 197 scoped_ptr<DetachedWebContentsDelegate> detached_delegate_;
198 198
199 base::WeakPtrFactory<FastUnloadController> weak_factory_; 199 base::WeakPtrFactory<FastUnloadController> weak_factory_;
200 200
201 DISALLOW_COPY_AND_ASSIGN(FastUnloadController); 201 DISALLOW_COPY_AND_ASSIGN(FastUnloadController);
202 }; 202 };
203 203
204 } // namespace chrome 204 } // namespace chrome
205 205
206 #endif // CHROME_BROWSER_UI_FAST_UNLOAD_CONTROLLER_H_ 206 #endif // CHROME_BROWSER_UI_FAST_UNLOAD_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698