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