// Copyright 2012 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_ITERATOR_H_ #define CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_ITERATOR_H_ #include <iterator> #include "base/memory/stack_allocated.h" #include "chrome/browser/ui/browser_list.h" namespace content { class WebContents; } // Iterates through all tab contents in all browser windows. Because the // renderers act asynchronously, getting a tab contents through this interface // does not guarantee that the renderer is ready to go. Doing anything to affect // browser windows or tabs while iterating may cause incorrect behavior. // // Examples: // // for (auto* web_contents : AllTabContentses()) { // SomeFunctionTakingWebContents(web_contents); // -or- // web_contents->OperationOnWebContents(); // ... // } // // auto& all_tabs = AllTabContentses(); // auto it = some_std_algorithm(all_tabs.begin(), all_tabs.end(), ...); class AllTabContentsesList { … }; const AllTabContentsesList& AllTabContentses(); #endif // CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_ITERATOR_H_