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

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

Issue 2042123005: Revert of 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: 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
178 // Returns the cocoa-world BrowserWindowController 175 // Returns the cocoa-world BrowserWindowController
179 BrowserWindowController* cocoa_controller() { return controller_; } 176 BrowserWindowController* cocoa_controller() { return controller_; }
180 177
181 // Returns window title based on the active tab title and the window's alert 178 // Returns window title based on the active tab title and the window's alert
182 // state. 179 // state.
183 NSString* WindowTitle(); 180 NSString* WindowTitle();
184 181
185 // Returns the current alert state, determined by the alert state of tabs. Set 182 // Returns the current alert state, determined by the alert state of tabs. Set
186 // by UpdateAlertState. 183 // by UpdateAlertState.
187 TabAlertState alert_state() { return alert_state_; } 184 TabAlertState alert_state() { return alert_state_; }
188 185
189 protected: 186 protected:
190 void DestroyBrowser() override; 187 void DestroyBrowser() override;
191 188
192 private: 189 private:
193 NSWindow* window() const; // Accessor for the (current) |NSWindow|. 190 NSWindow* window() const; // Accessor for the (current) |NSWindow|.
194 191
195 Browser* browser_; // weak, owned by controller 192 Browser* browser_; // weak, owned by controller
196 BrowserWindowController* controller_; // weak, owns us 193 BrowserWindowController* controller_; // weak, owns us
197 base::scoped_nsobject<NSString> pending_window_title_; 194 base::scoped_nsobject<NSString> pending_window_title_;
198 ui::WindowShowState initial_show_state_; 195 ui::WindowShowState initial_show_state_;
199 NSInteger attention_request_id_; // identifier from requestUserAttention 196 NSInteger attention_request_id_; // identifier from requestUserAttention
200 197
201 // Preserves window alert state to show appropriate icon in the window title 198 // Preserves window alert state to show appropriate icon in the window title
202 // which can be audio playing, muting or none (determined by alert state of 199 // which can be audio playing, muting or none (determined by alert state of
203 // tabs. 200 // tabs.
204 TabAlertState alert_state_; 201 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_;
209 }; 202 };
210 203
211 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_WINDOW_COCOA_H_ 204 #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