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

Unified Diff: chrome/browser/lifetime/application_lifetime.cc

Issue 1644773003: Remove BrowserIterator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@host-desktop-1
Patch Set: . Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/fast_shutdown_browsertest.cc ('k') | chrome/browser/lifetime/browser_close_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/lifetime/application_lifetime.cc
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc
index 448b4929e72b2968a41d4739511e53b869035dff..f914130bbcd8ef5ee9c6216adf2e7235a4c516c9 100644
--- a/chrome/browser/lifetime/application_lifetime.cc
+++ b/chrome/browser/lifetime/application_lifetime.cc
@@ -23,7 +23,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
-#include "chrome/browser/ui/browser_iterator.h"
+#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
@@ -54,8 +54,7 @@ namespace {
// This currently checks if there is pending download, or if it needs to
// handle unload handler.
bool AreAllBrowsersCloseable() {
- chrome::BrowserIterator browser_it;
- if (browser_it.done())
+ if (BrowserList::GetInstance()->empty())
return true;
// If there are any downloads active, all browsers are not closeable.
@@ -64,8 +63,8 @@ bool AreAllBrowsersCloseable() {
return false;
// Check TabsNeedBeforeUnloadFired().
- for (; !browser_it.done(); browser_it.Next()) {
- if (browser_it->TabsNeedBeforeUnloadFired())
+ for (auto* browser : *BrowserList::GetInstance()) {
+ if (browser->TabsNeedBeforeUnloadFired())
return false;
}
return true;
@@ -84,8 +83,8 @@ bool g_send_stop_request_to_session_manager = false;
void MarkAsCleanShutdown() {
// TODO(beng): Can this use ProfileManager::GetLoadedProfiles() instead?
- for (chrome::BrowserIterator it; !it.done(); it.Next())
- it->profile()->SetExitType(Profile::EXIT_NORMAL);
+ for (auto* browser : *BrowserList::GetInstance())
+ browser->profile()->SetExitType(Profile::EXIT_NORMAL);
}
void AttemptExitInternal(bool try_to_quit_application) {
@@ -176,8 +175,8 @@ void AttemptUserExit() {
#if !defined(OS_ANDROID)
void AttemptRestart() {
// TODO(beng): Can this use ProfileManager::GetLoadedProfiles instead?
- for (chrome::BrowserIterator it; !it.done(); it.Next())
- content::BrowserContext::SaveSessionState(it->profile());
+ for (auto* browser : *BrowserList::GetInstance())
+ content::BrowserContext::SaveSessionState(browser->profile());
PrefService* pref_service = g_browser_process->local_state();
pref_service->SetBoolean(prefs::kWasRestarted, true);
« no previous file with comments | « chrome/browser/fast_shutdown_browsertest.cc ('k') | chrome/browser/lifetime/browser_close_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698