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

Unified Diff: ios/shared/chrome/browser/ui/browser_list/browser_list.h

Issue 2798863004: [ios] Extend BrowserList API. (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ios/shared/chrome/browser/ui/browser_list/browser_list.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « no previous file | ios/shared/chrome/browser/ui/browser_list/browser_list.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698