Chromium Code Reviews| Index: ios/shared/chrome/browser/ui/browser_list/browser_list.h |
| diff --git a/ios/shared/chrome/browser/ui/browser_list/browser_list.h b/ios/shared/chrome/browser/ui/browser_list/browser_list.h |
| index 6f4446d93134276b5307c4ac13e53cd73ad5e798..bb5dd72cd0e9616e9f3883f415b6294278e92ec3 100644 |
| --- a/ios/shared/chrome/browser/ui/browser_list/browser_list.h |
| +++ b/ios/shared/chrome/browser/ui/browser_list/browser_list.h |
| @@ -24,14 +24,17 @@ class BrowserList : public base::SupportsUserData::Data { |
| static BrowserList* FromBrowserState(ios::ChromeBrowserState* browser_state); |
| - // Returns the number of open Browsers. |
| - int GetBrowserCount() const; |
| + // Returns the number of Browsers in the BrowserList. |
| + int count() const { return static_cast<int>(browsers_.size()); } |
|
marq (ping after 24h)
2017/04/05 13:43:24
Why move the implementation to the header?
sdefresne
2017/04/06 11:32:47
It is a trivial accessor and worth inlining (this
|
| // Returns whether the specified index is valid. |
| int ContainsIndex(int index) const; |
| // Returns the Browser at the specified index. |
| - Browser* GetBrowserAtIndex(int index) const; |
| + Browser* GetBrowserAt(int index) const; |
| + |
| + // Returns the index of the specified Browser, or kInvalidIndex if not found. |
| + int GetIndexOfBrowser(const Browser* browser) const; |
| // Creates and returns a new Browser instance. |
| Browser* CreateNewBrowser(); |
| @@ -39,6 +42,9 @@ class BrowserList : public base::SupportsUserData::Data { |
| // Closes the Browser at the specified index. |
| void CloseBrowserAtIndex(int index); |
| + // Invalid index. |
| + static const int kInvalidIndex = -1; |
| + |
| private: |
| ios::ChromeBrowserState* browser_state_; |
| std::vector<std::unique_ptr<Browser>> browsers_; |