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

Side by Side Diff: chrome/browser/ui/browser_list.cc

Issue 6257014: Once we initiate shutdown sequence, don't show crash bar on subsequent startu... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 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
« no previous file with comments | « chrome/browser/ui/browser_list.h ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "chrome/browser/browser_list.h" 5 #include "chrome/browser/browser_list.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 NotificationService::NoDetails()); 176 NotificationService::NoDetails());
177 177
178 // Send out notifications after add has occurred. Do some basic checking to 178 // Send out notifications after add has occurred. Do some basic checking to
179 // try to catch evil observers that change the list from under us. 179 // try to catch evil observers that change the list from under us.
180 size_t original_count = observers_.size(); 180 size_t original_count = observers_.size();
181 FOR_EACH_OBSERVER(Observer, observers_, OnBrowserAdded(browser)); 181 FOR_EACH_OBSERVER(Observer, observers_, OnBrowserAdded(browser));
182 DCHECK_EQ(original_count, observers_.size()) 182 DCHECK_EQ(original_count, observers_.size())
183 << "observer list modified during notification"; 183 << "observer list modified during notification";
184 } 184 }
185 185
186 // static
187 void BrowserList::MarkAsCleanShutdown() {
188 for (const_iterator i = begin(); i != end(); ++i) {
189 (*i)->profile()->MarkAsCleanShutdown();
190 }
191 }
186 192
187 // static 193 // static
188 void BrowserList::NotifyAndTerminate() { 194 void BrowserList::NotifyAndTerminate() {
189 NotificationService::current()->Notify(NotificationType::APP_TERMINATING, 195 NotificationService::current()->Notify(NotificationType::APP_TERMINATING,
190 NotificationService::AllSources(), 196 NotificationService::AllSources(),
191 NotificationService::NoDetails()); 197 NotificationService::NoDetails());
192 #if defined(OS_CHROMEOS) 198 #if defined(OS_CHROMEOS)
193 chromeos::WmIpc::instance()->NotifyAboutSignout(); 199 chromeos::WmIpc::instance()->NotifyAboutSignout();
194 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) { 200 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) {
195 chromeos::CrosLibrary::Get()->GetLoginLibrary()->StopSession(""); 201 chromeos::CrosLibrary::Get()->GetLoginLibrary()->StopSession("");
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 261
256 // static 262 // static
257 void BrowserList::RemoveObserver(BrowserList::Observer* observer) { 263 void BrowserList::RemoveObserver(BrowserList::Observer* observer) {
258 observers_.RemoveObserver(observer); 264 observers_.RemoveObserver(observer);
259 } 265 }
260 266
261 #if defined(OS_CHROMEOS) 267 #if defined(OS_CHROMEOS)
262 // static 268 // static
263 bool BrowserList::NeedBeforeUnloadFired() { 269 bool BrowserList::NeedBeforeUnloadFired() {
264 bool need_before_unload_fired = false; 270 bool need_before_unload_fired = false;
265 for (BrowserList::const_iterator i = BrowserList::begin(); 271 for (const_iterator i = begin(); i != end(); ++i) {
266 i != BrowserList::end(); ++i) {
267 need_before_unload_fired = need_before_unload_fired || 272 need_before_unload_fired = need_before_unload_fired ||
268 (*i)->TabsNeedBeforeUnloadFired(); 273 (*i)->TabsNeedBeforeUnloadFired();
269 } 274 }
270 return need_before_unload_fired; 275 return need_before_unload_fired;
271 } 276 }
272 277
273 // static 278 // static
274 bool BrowserList::PendingDownloads() { 279 bool BrowserList::PendingDownloads() {
275 for (BrowserList::const_iterator i = BrowserList::begin(); 280 for (const_iterator i = begin(); i != end(); ++i) {
276 i != BrowserList::end(); ++i) {
277 bool normal_downloads_are_present = false; 281 bool normal_downloads_are_present = false;
278 bool incognito_downloads_are_present = false; 282 bool incognito_downloads_are_present = false;
279 (*i)->CheckDownloadsInProgress(&normal_downloads_are_present, 283 (*i)->CheckDownloadsInProgress(&normal_downloads_are_present,
280 &incognito_downloads_are_present); 284 &incognito_downloads_are_present);
281 if (normal_downloads_are_present || incognito_downloads_are_present) 285 if (normal_downloads_are_present || incognito_downloads_are_present)
282 return true; 286 return true;
283 } 287 }
284 return false; 288 return false;
285 } 289 }
286 #endif 290 #endif
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 && !PendingDownloads()) { 351 && !PendingDownloads()) {
348 NotifyAndTerminate(); 352 NotifyAndTerminate();
349 return; 353 return;
350 } 354 }
351 #endif 355 #endif
352 CloseAllBrowsersAndExit(); 356 CloseAllBrowsersAndExit();
353 } 357 }
354 358
355 // static 359 // static
356 void BrowserList::CloseAllBrowsersAndExit() { 360 void BrowserList::CloseAllBrowsersAndExit() {
361 MarkAsCleanShutdown(); // Don't notify users of crashes beyond this point.
Daniel Erat 2011/01/25 02:29:42 I think you might be missing the fast-shutdown pat
357 NotificationService::current()->Notify( 362 NotificationService::current()->Notify(
358 NotificationType::APP_EXITING, 363 NotificationType::APP_EXITING,
359 NotificationService::AllSources(), 364 NotificationService::AllSources(),
360 NotificationService::NoDetails()); 365 NotificationService::NoDetails());
361 366
362 #if !defined(OS_MACOSX) 367 #if !defined(OS_MACOSX)
363 // On most platforms, closing all windows causes the application to exit. 368 // On most platforms, closing all windows causes the application to exit.
364 CloseAllBrowsers(); 369 CloseAllBrowsers();
365 #else 370 #else
366 // On the Mac, the application continues to run once all windows are closed. 371 // On the Mac, the application continues to run once all windows are closed.
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 } 598 }
594 599
595 TabContents* next_tab = 600 TabContents* next_tab =
596 (*browser_iterator_)->GetTabContentsAt(web_view_index_); 601 (*browser_iterator_)->GetTabContentsAt(web_view_index_);
597 if (next_tab) { 602 if (next_tab) {
598 cur_ = next_tab; 603 cur_ = next_tab;
599 return; 604 return;
600 } 605 }
601 } 606 }
602 } 607 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698