Index: chrome/browser/ui/tab_contents/tab_contents_iterator.cc |
diff --git a/chrome/browser/ui/tab_contents/tab_contents_iterator.cc b/chrome/browser/ui/tab_contents/tab_contents_iterator.cc |
index bc035776d812f79fa5ef230901461b18e831bc46..34df98b4f108f366b760595987beed9229e36d9c 100644 |
--- a/chrome/browser/ui/tab_contents/tab_contents_iterator.cc |
+++ b/chrome/browser/ui/tab_contents/tab_contents_iterator.cc |
@@ -11,25 +11,29 @@ |
TabContentsIterator::TabContentsIterator() |
: web_view_index_(-1), |
- cur_(NULL) { |
+ cur_(NULL), |
+ browser_iterator_(BrowserList::GetInstance()->begin()) { |
// Load the first WebContents into |cur_|. |
Next(); |
} |
+TabContentsIterator::~TabContentsIterator() { |
+} |
+ |
void TabContentsIterator::Next() { |
// The current WebContents should be valid unless we are at the beginning. |
DCHECK(cur_ || web_view_index_ == -1) << "Trying to advance past the end"; |
// Update |cur_| to the next WebContents in the list. |
- while (!browser_iterator_.done()) { |
- if (++web_view_index_ >= browser_iterator_->tab_strip_model()->count()) { |
+ while (browser_iterator_ != BrowserList::GetInstance()->end()) { |
+ if (++web_view_index_ >= (*browser_iterator_)->tab_strip_model()->count()) { |
// Advance to the next Browser in the list. |
- browser_iterator_.Next(); |
+ ++browser_iterator_; |
web_view_index_ = -1; |
continue; |
} |
- content::WebContents* next_tab = browser_iterator_->tab_strip_model() |
+ content::WebContents* next_tab = (*browser_iterator_)->tab_strip_model() |
->GetWebContentsAt(web_view_index_); |
if (next_tab) { |
cur_ = next_tab; |