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

Side by Side Diff: chrome/browser/ui/browser_list.h

Issue 10105030: TabContents -> WebContentsImpl, part 21. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/browser_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_BROWSER_LIST_H_ 5 #ifndef CHROME_BROWSER_UI_BROWSER_LIST_H_
6 #define CHROME_BROWSER_UI_BROWSER_LIST_H_ 6 #define CHROME_BROWSER_UI_BROWSER_LIST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 222
223 class TabContentsWrapper; 223 class TabContentsWrapper;
224 224
225 // Iterates through all web view hosts in all browser windows. Because the 225 // Iterates through all web view hosts in all browser windows. Because the
226 // renderers act asynchronously, getting a host through this interface does 226 // renderers act asynchronously, getting a host through this interface does
227 // not guarantee that the renderer is ready to go. Doing anything to affect 227 // not guarantee that the renderer is ready to go. Doing anything to affect
228 // browser windows or tabs while iterating may cause incorrect behavior. 228 // browser windows or tabs while iterating may cause incorrect behavior.
229 // 229 //
230 // Example: 230 // Example:
231 // for (TabContentsIterator iterator; !iterator.done(); ++iterator) { 231 // for (TabContentsIterator iterator; !iterator.done(); ++iterator) {
232 // TabContents* cur = *iterator; 232 // TabContentsWrapper* cur = *iterator;
233 // -or- 233 // -or-
234 // iterator->operationOnTabContents(); 234 // iterator->operationOnTabContents();
235 // ... 235 // ...
236 // } 236 // }
237 class TabContentsIterator { 237 class TabContentsIterator {
238 public: 238 public:
239 TabContentsIterator(); 239 TabContentsIterator();
240 240
241 // Returns true if we are past the last Browser. 241 // Returns true if we are past the last Browser.
242 bool done() const { 242 bool done() const {
243 return cur_ == NULL; 243 return cur_ == NULL;
244 } 244 }
245 245
246 // Returns the Browser instance associated with the current TabContents. 246 // Returns the Browser instance associated with the current
247 // Valid as long as !done() 247 // TabContentsWrapper. Valid as long as !done()
248 Browser* browser() const { 248 Browser* browser() const {
249 if (browser_iterator_ != BrowserList::end()) 249 if (browser_iterator_ != BrowserList::end())
250 return *browser_iterator_; 250 return *browser_iterator_;
251 return NULL; 251 return NULL;
252 } 252 }
253 253
254 // Returns the current TabContents, valid as long as !Done() 254 // Returns the current TabContentsWrapper, valid as long as !Done()
255 TabContentsWrapper* operator->() const { 255 TabContentsWrapper* operator->() const {
256 return cur_; 256 return cur_;
257 } 257 }
258 TabContentsWrapper* operator*() const { 258 TabContentsWrapper* operator*() const {
259 return cur_; 259 return cur_;
260 } 260 }
261 261
262 // Incrementing operators, valid as long as !Done() 262 // Incrementing operators, valid as long as !Done()
263 TabContentsWrapper* operator++() { // ++preincrement 263 TabContentsWrapper* operator++() { // ++preincrement
264 Advance(); 264 Advance();
(...skipping 13 matching lines...) Expand all
278 278
279 // iterator over all the Browser objects 279 // iterator over all the Browser objects
280 BrowserList::const_iterator browser_iterator_; 280 BrowserList::const_iterator browser_iterator_;
281 281
282 // tab index into the current Browser of the current web view 282 // tab index into the current Browser of the current web view
283 int web_view_index_; 283 int web_view_index_;
284 284
285 // iterator over the TabContentsWrappers doing background printing. 285 // iterator over the TabContentsWrappers doing background printing.
286 std::set<TabContentsWrapper*>::const_iterator bg_printing_iterator_; 286 std::set<TabContentsWrapper*>::const_iterator bg_printing_iterator_;
287 287
288 // Current TabContents, or NULL if we're at the end of the list. This can 288 // Current TabContentsWrapper, or NULL if we're at the end of the list. This
289 // be extracted given the browser iterator and index, but it's nice to cache 289 // can be extracted given the browser iterator and index, but it's nice to
290 // this since the caller may access the current host many times. 290 // cache this since the caller may access the current host many times.
291 TabContentsWrapper* cur_; 291 TabContentsWrapper* cur_;
292 }; 292 };
293 293
294 #endif // CHROME_BROWSER_UI_BROWSER_LIST_H_ 294 #endif // CHROME_BROWSER_UI_BROWSER_LIST_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/browser_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698