OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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_CLEAN_CHROME_BROWSER_MODEL_BROWSER_LIST_H_ |
| 6 #define IOS_CLEAN_CHROME_BROWSER_MODEL_BROWSER_LIST_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/supports_user_data.h" |
| 12 #include "ios/clean/chrome/browser/model/browser.h" |
| 13 |
| 14 namespace ios { |
| 15 class ChromeBrowserState; |
| 16 } |
| 17 |
| 18 // BrowserList attaches Browsers instance to a ChromeBrowserState. |
| 19 class BrowserList : public base::SupportsUserData::Data { |
| 20 public: |
| 21 explicit BrowserList(ios::ChromeBrowserState* browser_state); |
| 22 ~BrowserList() override; |
| 23 |
| 24 static BrowserList* FromBrowserState(ios::ChromeBrowserState* browser_state); |
| 25 |
| 26 // Returns the number of open Browsers. |
| 27 int GetBrowserCount() const; |
| 28 |
| 29 // Returns whether the specified index is valid. |
| 30 int ContainsIndex(int index) const; |
| 31 |
| 32 // Returns the Browser at the specified index. |
| 33 Browser* GetBrowserAtIndex(int index) const; |
| 34 |
| 35 // Creates and returns a new Browser instance. |
| 36 Browser* CreateNewBrowser(); |
| 37 |
| 38 // Closes the Browser at the specified index. |
| 39 void CloseBrowserAtIndex(int index); |
| 40 |
| 41 private: |
| 42 std::vector<std::unique_ptr<Browser>> browsers_; |
| 43 ios::ChromeBrowserState* browser_state_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(BrowserList); |
| 46 }; |
| 47 |
| 48 #endif // IOS_CLEAN_CHROME_BROWSER_MODEL_BROWSER_LIST_H_ |
OLD | NEW |