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

Side by Side Diff: chrome/browser/ui/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: 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
« chrome/browser/ui/browser.cc ('K') | « chrome/browser/ui/browser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 // Returns true if |browser_| has any tabs that have BeforeUnload handlers 72 // Returns true if |browser_| has any tabs that have BeforeUnload handlers
73 // that have not been fired. This method is non-const because it builds a list 73 // that have not been fired. This method is non-const because it builds a list
74 // of tabs that need their BeforeUnloadHandlers fired. 74 // of tabs that need their BeforeUnloadHandlers fired.
75 // TODO(beng): This seems like it could be private but it is used by 75 // TODO(beng): This seems like it could be private but it is used by
76 // AreAllBrowsersCloseable() in application_lifetime.cc. It seems 76 // AreAllBrowsersCloseable() in application_lifetime.cc. It seems
77 // very similar to ShouldCloseWindow() and some consolidation 77 // very similar to ShouldCloseWindow() and some consolidation
78 // could be pursued. 78 // could be pursued.
79 bool TabsNeedBeforeUnloadFired(); 79 bool TabsNeedBeforeUnloadFired();
80 80
81 // Clears all the state associated with processing tabs' beforeunload/unload
82 // events since the user cancelled closing the window.
83 void CancelWindowClose();
84
81 private: 85 private:
82 typedef std::set<content::WebContents*> UnloadListenerSet; 86 typedef std::set<content::WebContents*> UnloadListenerSet;
83 87
84 // Overridden from content::NotificationObserver: 88 // Overridden from content::NotificationObserver:
85 virtual void Observe(int type, 89 virtual void Observe(int type,
86 const content::NotificationSource& source, 90 const content::NotificationSource& source,
87 const content::NotificationDetails& details) OVERRIDE; 91 const content::NotificationDetails& details) OVERRIDE;
88 92
89 // Overridden from TabStripModelObserver: 93 // Overridden from TabStripModelObserver:
90 virtual void TabInsertedAt(content::WebContents* contents, 94 virtual void TabInsertedAt(content::WebContents* contents,
91 int index, 95 int index,
92 bool foreground) OVERRIDE; 96 bool foreground) OVERRIDE;
93 virtual void TabDetachedAt(content::WebContents* contents, 97 virtual void TabDetachedAt(content::WebContents* contents,
94 int index) OVERRIDE; 98 int index) OVERRIDE;
95 virtual void TabReplacedAt(TabStripModel* tab_strip_model, 99 virtual void TabReplacedAt(TabStripModel* tab_strip_model,
96 content::WebContents* old_contents, 100 content::WebContents* old_contents,
97 content::WebContents* new_contents, 101 content::WebContents* new_contents,
98 int index) OVERRIDE; 102 int index) OVERRIDE;
99 virtual void TabStripEmpty() OVERRIDE; 103 virtual void TabStripEmpty() OVERRIDE;
100 104
101 void TabAttachedImpl(content::WebContents* contents); 105 void TabAttachedImpl(content::WebContents* contents);
102 void TabDetachedImpl(content::WebContents* contents); 106 void TabDetachedImpl(content::WebContents* contents);
103 107
104 // Processes the next tab that needs it's beforeunload/unload event fired. 108 // Processes the next tab that needs it's beforeunload/unload event fired.
105 void ProcessPendingTabs(); 109 void ProcessPendingTabs();
106 110
107 // Whether we've completed firing all the tabs' beforeunload/unload events. 111 // Whether we've completed firing all the tabs' beforeunload/unload events.
108 bool HasCompletedUnloadProcessing() const; 112 bool HasCompletedUnloadProcessing() const;
109 113
110 // Clears all the state associated with processing tabs' beforeunload/unload
111 // events since the user cancelled closing the window.
112 void CancelWindowClose();
113
114 // Removes |web_contents| from the passed |set|. 114 // Removes |web_contents| from the passed |set|.
115 // Returns whether the tab was in the set in the first place. 115 // Returns whether the tab was in the set in the first place.
116 bool RemoveFromSet(UnloadListenerSet* set, 116 bool RemoveFromSet(UnloadListenerSet* set,
117 content::WebContents* web_contents); 117 content::WebContents* web_contents);
118 118
119 // Cleans up state appropriately when we are trying to close the browser and 119 // Cleans up state appropriately when we are trying to close the browser and
120 // the tab has finished firing its unload handler. We also use this in the 120 // the tab has finished firing its unload handler. We also use this in the
121 // cases where a tab crashes or hangs even if the beforeunload/unload haven't 121 // cases where a tab crashes or hangs even if the beforeunload/unload haven't
122 // successfully fired. If |process_now| is true |ProcessPendingTabs| is 122 // successfully fired. If |process_now| is true |ProcessPendingTabs| is
123 // invoked immediately, otherwise it is invoked after a delay (PostTask). 123 // invoked immediately, otherwise it is invoked after a delay (PostTask).
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 base::Callback<void(bool)> on_close_confirmed_; 155 base::Callback<void(bool)> on_close_confirmed_;
156 156
157 base::WeakPtrFactory<UnloadController> weak_factory_; 157 base::WeakPtrFactory<UnloadController> weak_factory_;
158 158
159 DISALLOW_COPY_AND_ASSIGN(UnloadController); 159 DISALLOW_COPY_AND_ASSIGN(UnloadController);
160 }; 160 };
161 161
162 } // namespace chrome 162 } // namespace chrome
163 163
164 #endif // CHROME_BROWSER_UI_UNLOAD_CONTROLLER_H_ 164 #endif // CHROME_BROWSER_UI_UNLOAD_CONTROLLER_H_
OLDNEW
« chrome/browser/ui/browser.cc ('K') | « chrome/browser/ui/browser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698