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

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

Issue 12213074: BrowserList iterator methods have been phased out, delete them! (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | « no previous file | 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 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 11
12 class Browser; 12 class Browser;
13 class Profile; 13 class Profile;
14 14
15 namespace chrome { 15 namespace chrome {
16 class BrowserListObserver; 16 class BrowserListObserver;
17 } 17 }
18 18
19 // Stores a list of all Browser objects. 19 // Stores a list of all Browser objects.
20 class BrowserList { 20 class BrowserList {
21 public: 21 public:
22 typedef std::vector<Browser*> BrowserVector; 22 typedef std::vector<Browser*> BrowserVector;
23 typedef BrowserVector::const_iterator const_iterator;
24 typedef BrowserVector::const_reverse_iterator const_reverse_iterator; 23 typedef BrowserVector::const_reverse_iterator const_reverse_iterator;
25 24
26 // Adds and removes browsers from the global list. The browser object should 25 // Adds and removes browsers from the global list. The browser object should
27 // be valid BEFORE these calls (for the benefit of observers), so notify and 26 // be valid BEFORE these calls (for the benefit of observers), so notify and
28 // THEN delete the object. 27 // THEN delete the object.
29 static void AddBrowser(Browser* browser); 28 static void AddBrowser(Browser* browser);
30 static void RemoveBrowser(Browser* browser); 29 static void RemoveBrowser(Browser* browser);
31 30
32 static void AddObserver(chrome::BrowserListObserver* observer); 31 static void AddObserver(chrome::BrowserListObserver* observer);
33 static void RemoveObserver(chrome::BrowserListObserver* observer); 32 static void RemoveObserver(chrome::BrowserListObserver* observer);
34 33
35 // Called by Browser objects when their window is activated (focused). This 34 // Called by Browser objects when their window is activated (focused). This
36 // allows us to determine what the last active Browser was. 35 // allows us to determine what the last active Browser was.
37 static void SetLastActive(Browser* browser); 36 static void SetLastActive(Browser* browser);
38 37
39 // Closes all browsers for |profile|. 38 // Closes all browsers for |profile|.
40 static void CloseAllBrowsersWithProfile(Profile* profile); 39 static void CloseAllBrowsersWithProfile(Profile* profile);
41 40
42 // Browsers are added to the list before they have constructed windows,
43 // so the |window()| member function may return NULL.
44 static const_iterator begin();
45 static const_iterator end();
46
47 static bool empty(); 41 static bool empty();
48 static size_t size(); 42 static size_t size();
49 43
50 // Returns iterated access to list of open browsers ordered by when 44 // Returns iterated access to list of open browsers ordered by when
51 // they were last active. The underlying data structure is a vector 45 // they were last active. The underlying data structure is a vector
52 // and we push_back on recent access so a reverse iterator gives the 46 // and we push_back on recent access so a reverse iterator gives the
53 // latest accessed browser first. 47 // latest accessed browser first.
54 static const_reverse_iterator begin_last_active(); 48 static const_reverse_iterator begin_last_active();
55 static const_reverse_iterator end_last_active(); 49 static const_reverse_iterator end_last_active();
56 50
57 // Returns true if at least one incognito session is active. 51 // Returns true if at least one incognito session is active.
58 static bool IsOffTheRecordSessionActive(); 52 static bool IsOffTheRecordSessionActive();
59 53
60 // Returns true if at least one incognito session is active for |profile|. 54 // Returns true if at least one incognito session is active for |profile|.
61 static bool IsOffTheRecordSessionActiveForProfile(Profile* profile); 55 static bool IsOffTheRecordSessionActiveForProfile(Profile* profile);
62 }; 56 };
63 57
64 #endif // CHROME_BROWSER_UI_BROWSER_LIST_H_ 58 #endif // CHROME_BROWSER_UI_BROWSER_LIST_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/browser_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698