OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/browser_list.h" | 5 #include "chrome/browser/ui/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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 if (i != BrowserList::end() && browser == *i) { | 414 if (i != BrowserList::end() && browser == *i) { |
415 // Destroying the browser should have removed it from the browser list. | 415 // Destroying the browser should have removed it from the browser list. |
416 // We should never get here. | 416 // We should never get here. |
417 NOTREACHED(); | 417 NOTREACHED(); |
418 return; | 418 return; |
419 } | 419 } |
420 } | 420 } |
421 } | 421 } |
422 } | 422 } |
423 | 423 |
| 424 void BrowserList::CloseAllBrowsersWithProfile(Profile* profile) { |
| 425 BrowserVector browsers_to_close; |
| 426 for (BrowserList::const_iterator i = BrowserList::begin(); |
| 427 i != BrowserList::end(); ++i) { |
| 428 if ((*i)->profile() == profile) |
| 429 browsers_to_close.push_back(*i); |
| 430 } |
| 431 |
| 432 for (BrowserVector::const_iterator i = browsers_to_close.begin(); |
| 433 i != browsers_to_close.end(); ++i) { |
| 434 (*i)->window()->Close(); |
| 435 } |
| 436 } |
| 437 |
424 // static | 438 // static |
425 void BrowserList::AttemptUserExit() { | 439 void BrowserList::AttemptUserExit() { |
426 #if defined(OS_CHROMEOS) | 440 #if defined(OS_CHROMEOS) |
427 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutStarted", false); | 441 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutStarted", false); |
428 // Write /tmp/uptime-logout-started as well. | 442 // Write /tmp/uptime-logout-started as well. |
429 const char kLogoutStarted[] = "logout-started"; | 443 const char kLogoutStarted[] = "logout-started"; |
430 chromeos::BootTimesLoader::Get()->RecordCurrentStats(kLogoutStarted); | 444 chromeos::BootTimesLoader::Get()->RecordCurrentStats(kLogoutStarted); |
431 | 445 |
432 // Login screen should show up in owner's locale. | 446 // Login screen should show up in owner's locale. |
433 PrefService* state = g_browser_process->local_state(); | 447 PrefService* state = g_browser_process->local_state(); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 // If no more TabContents from Browsers, check the BackgroundPrintingManager. | 740 // If no more TabContents from Browsers, check the BackgroundPrintingManager. |
727 while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) { | 741 while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) { |
728 cur_ = *bg_printing_iterator_; | 742 cur_ = *bg_printing_iterator_; |
729 CHECK(cur_); | 743 CHECK(cur_); |
730 ++bg_printing_iterator_; | 744 ++bg_printing_iterator_; |
731 return; | 745 return; |
732 } | 746 } |
733 // Reached the end - no more TabContents. | 747 // Reached the end - no more TabContents. |
734 cur_ = NULL; | 748 cur_ = NULL; |
735 } | 749 } |
OLD | NEW |