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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_cocoa.h

Issue 2041213002: Address a crash under -[NSWindow close] via a WeakPtr PostTask from Browser::TabStripEmpty() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: windowWillClose Created 4 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/browser_window_cocoa.mm » ('j') | 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_COCOA_BROWSER_WINDOW_COCOA_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ 6 #define CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_
7 7
8 #include "base/mac/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/extensions/extension_keybinding_registry.h" 10 #include "chrome/browser/extensions/extension_keybinding_registry.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 const SearchModel::State& new_state) override; 165 const SearchModel::State& new_state) override;
166 166
167 // Adds the given FindBar cocoa controller to this browser window. 167 // Adds the given FindBar cocoa controller to this browser window.
168 void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller); 168 void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller);
169 169
170 // Updates the window's alert state. If the new alert state is 170 // Updates the window's alert state. If the new alert state is
171 // TabAlertState::AUDIO_PLAYING or TabAlertState::AUDIO_MUTING then sets 171 // TabAlertState::AUDIO_PLAYING or TabAlertState::AUDIO_MUTING then sets
172 // the window's title to reflect that. 172 // the window's title to reflect that.
173 void UpdateAlertState(TabAlertState alert_state); 173 void UpdateAlertState(TabAlertState alert_state);
174 174
175 // Called when the controller's window invokes -windowWillClose:.
176 void OnWindowWillClose();
177
175 // Returns the cocoa-world BrowserWindowController 178 // Returns the cocoa-world BrowserWindowController
176 BrowserWindowController* cocoa_controller() { return controller_; } 179 BrowserWindowController* cocoa_controller() { return controller_; }
177 180
178 // Returns window title based on the active tab title and the window's alert 181 // Returns window title based on the active tab title and the window's alert
179 // state. 182 // state.
180 NSString* WindowTitle(); 183 NSString* WindowTitle();
181 184
182 // Returns the current alert state, determined by the alert state of tabs. Set 185 // Returns the current alert state, determined by the alert state of tabs. Set
183 // by UpdateAlertState. 186 // by UpdateAlertState.
184 TabAlertState alert_state() { return alert_state_; } 187 TabAlertState alert_state() { return alert_state_; }
185 188
186 protected: 189 protected:
187 void DestroyBrowser() override; 190 void DestroyBrowser() override;
188 191
189 private: 192 private:
190 NSWindow* window() const; // Accessor for the (current) |NSWindow|. 193 NSWindow* window() const; // Accessor for the (current) |NSWindow|.
191 194
192 Browser* browser_; // weak, owned by controller 195 Browser* browser_; // weak, owned by controller
193 BrowserWindowController* controller_; // weak, owns us 196 BrowserWindowController* controller_; // weak, owns us
194 base::scoped_nsobject<NSString> pending_window_title_; 197 base::scoped_nsobject<NSString> pending_window_title_;
195 ui::WindowShowState initial_show_state_; 198 ui::WindowShowState initial_show_state_;
196 NSInteger attention_request_id_; // identifier from requestUserAttention 199 NSInteger attention_request_id_; // identifier from requestUserAttention
197 200
198 // Preserves window alert state to show appropriate icon in the window title 201 // Preserves window alert state to show appropriate icon in the window title
199 // which can be audio playing, muting or none (determined by alert state of 202 // which can be audio playing, muting or none (determined by alert state of
200 // tabs. 203 // tabs.
201 TabAlertState alert_state_; 204 TabAlertState alert_state_;
205
206 // True when the controlled window invokes -windowWillClose:, and it may no
207 // longer be safe to access [controller_ window].
208 bool window_closed_;
202 }; 209 };
203 210
204 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ 211 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/browser_window_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698