Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / browser_iterator.cc
blob4a69c1d7a0c2e6beaada0d142b6ac2d0fc08c9fe
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/browser_iterator.h"
7 namespace chrome {
9 BrowserIterator::BrowserIterator()
10 : current_browser_list_(BrowserList::GetInstance(HOST_DESKTOP_TYPE_FIRST)),
11 current_iterator_(current_browser_list_->begin()),
12 next_desktop_type_(
13 static_cast<HostDesktopType>(HOST_DESKTOP_TYPE_FIRST + 1)) {
14 NextBrowserListIfAtEnd();
17 BrowserIterator::~BrowserIterator() {
20 void BrowserIterator::Next() {
21 ++current_iterator_;
22 NextBrowserListIfAtEnd();
25 void BrowserIterator::NextBrowserListIfAtEnd() {
26 // Make sure either |current_iterator_| is valid or done().
27 while (current_iterator_ == current_browser_list_->end() &&
28 next_desktop_type_ < HOST_DESKTOP_TYPE_COUNT) {
29 current_browser_list_ = BrowserList::GetInstance(next_desktop_type_);
30 current_iterator_ = current_browser_list_->begin();
31 next_desktop_type_ = static_cast<HostDesktopType>(next_desktop_type_ + 1);
35 } // namespace chrome