OLD | NEW |
| (Empty) |
1 // Copyright 2012 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. | |
4 | |
5 #ifndef IOS_CHROME_BROWSER_UI_BROWSER_LIST_IOS_H_ | |
6 #define IOS_CHROME_BROWSER_UI_BROWSER_LIST_IOS_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #import "ios/chrome/browser/ui/browser_ios.h" | |
11 | |
12 namespace ios { | |
13 class ChromeBrowserState; | |
14 } | |
15 | |
16 // Modeled after chrome/browser/ui/browser_list. | |
17 | |
18 class BrowserListIOS { | |
19 public: | |
20 typedef std::vector<id<BrowserIOS>> BrowserVector; | |
21 typedef BrowserVector::iterator iterator; | |
22 typedef BrowserVector::const_iterator const_iterator; | |
23 | |
24 // Note: browsers are not retained, just like desktop browser lists, their | |
25 // management is outside the list. | |
26 static void AddBrowser(id<BrowserIOS> browser); | |
27 static void RemoveBrowser(id<BrowserIOS> browser); | |
28 | |
29 static id<BrowserIOS> GetLastActiveWithBrowserState( | |
30 ios::ChromeBrowserState* browser_state); | |
31 | |
32 static const_iterator begin(); | |
33 static const_iterator end(); | |
34 | |
35 static bool empty() { return !browsers_ || browsers_->empty(); } | |
36 static size_t size() { return browsers_ ? browsers_->size() : 0; } | |
37 | |
38 // Returns true if at least one incognito session is active. | |
39 static bool IsOffTheRecordSessionActive(); | |
40 | |
41 private: | |
42 static BrowserVector* browsers_; | |
43 | |
44 static void EnsureBrowsersIsValid(); | |
45 }; | |
46 | |
47 #endif // IOS_CHROME_BROWSER_UI_BROWSER_LIST_IOS_H_ | |
OLD | NEW |