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

Unified Diff: chrome/browser/ui/browser_list.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/ui/browser_iterator.cc ('k') | chrome/browser/ui/browser_tab_strip_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_list.cc
diff --git a/chrome/browser/ui/browser_list.cc b/chrome/browser/ui/browser_list.cc
index a02cb9958da2c8785d2ae4daff51294e411d53d7..00d1e5a210bdee46891bc3b5d722c6322bd477e2 100644
--- a/chrome/browser/ui/browser_list.cc
+++ b/chrome/browser/ui/browser_list.cc
@@ -15,7 +15,7 @@
#include "chrome/browser/profiles/profile.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_list_observer.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/host_desktop.h"
@@ -112,9 +112,10 @@ void BrowserList::RemoveObserver(chrome::BrowserListObserver* observer) {
// static
void BrowserList::CloseAllBrowsersWithProfile(Profile* profile) {
BrowserVector browsers_to_close;
- for (chrome::BrowserIterator it; !it.done(); it.Next()) {
- if (it->profile()->GetOriginalProfile() == profile->GetOriginalProfile())
- browsers_to_close.push_back(*it);
+ for (auto* browser : *BrowserList::GetInstance()) {
+ if (browser->profile()->GetOriginalProfile() ==
+ profile->GetOriginalProfile())
+ browsers_to_close.push_back(browser);
}
for (BrowserVector::const_iterator it = browsers_to_close.begin();
@@ -127,9 +128,10 @@ void BrowserList::CloseAllBrowsersWithProfile(Profile* profile) {
void BrowserList::CloseAllBrowsersWithProfile(Profile* profile,
const base::Callback<void(const base::FilePath&)>& on_close_success) {
BrowserVector browsers_to_close;
- for (chrome::BrowserIterator it; !it.done(); it.Next()) {
- if (it->profile()->GetOriginalProfile() == profile->GetOriginalProfile())
- browsers_to_close.push_back(*it);
+ for (auto* browser : *BrowserList::GetInstance()) {
+ if (browser->profile()->GetOriginalProfile() ==
+ profile->GetOriginalProfile())
+ browsers_to_close.push_back(browser);
}
TryToCloseBrowserList(browsers_to_close,
@@ -197,8 +199,8 @@ void BrowserList::SetLastActive(Browser* browser) {
// static
bool BrowserList::IsOffTheRecordSessionActive() {
- for (chrome::BrowserIterator it; !it.done(); it.Next()) {
- if (it->profile()->IsOffTheRecord())
+ for (auto* browser : *BrowserList::GetInstance()) {
+ if (browser->profile()->IsOffTheRecord())
return true;
}
return false;
@@ -206,9 +208,9 @@ bool BrowserList::IsOffTheRecordSessionActive() {
// static
bool BrowserList::IsOffTheRecordSessionActiveForProfile(Profile* profile) {
- for (chrome::BrowserIterator it; !it.done(); it.Next()) {
- if (it->profile()->IsSameProfile(profile) &&
- it->profile()->IsOffTheRecord()) {
+ for (auto* browser : *BrowserList::GetInstance()) {
+ if (browser->profile()->IsSameProfile(profile) &&
+ browser->profile()->IsOffTheRecord()) {
return true;
}
}
« no previous file with comments | « chrome/browser/ui/browser_iterator.cc ('k') | chrome/browser/ui/browser_tab_strip_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698