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

Unified Diff: ios/clean/chrome/browser/model/browser_list.h

Issue 2727353006: Introduce BrowserList and Browser classes for iOS. (Closed)
Patch Set: Add blank line. Created 3 years, 10 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 | « ios/clean/chrome/browser/model/browser.mm ('k') | ios/clean/chrome/browser/model/browser_list.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/clean/chrome/browser/model/browser_list.h
diff --git a/ios/clean/chrome/browser/model/browser_list.h b/ios/clean/chrome/browser/model/browser_list.h
new file mode 100644
index 0000000000000000000000000000000000000000..184718c46db058b13a99ccf91a3379ba02126138
--- /dev/null
+++ b/ios/clean/chrome/browser/model/browser_list.h
@@ -0,0 +1,48 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CLEAN_CHROME_BROWSER_MODEL_BROWSER_LIST_H_
+#define IOS_CLEAN_CHROME_BROWSER_MODEL_BROWSER_LIST_H_
+
+#include <vector>
+
+#include "base/macros.h"
+#include "base/supports_user_data.h"
+#include "ios/clean/chrome/browser/model/browser.h"
+
+namespace ios {
+class ChromeBrowserState;
+}
+
+// BrowserList attaches Browsers instance to a ChromeBrowserState.
+class BrowserList : public base::SupportsUserData::Data {
+ public:
+ explicit BrowserList(ios::ChromeBrowserState* browser_state);
+ ~BrowserList() override;
+
+ static BrowserList* FromBrowserState(ios::ChromeBrowserState* browser_state);
+
+ // Returns the number of open Browsers.
+ int GetBrowserCount() const;
+
+ // Returns whether the specified index is valid.
+ int ContainsIndex(int index) const;
+
+ // Returns the Browser at the specified index.
+ Browser* GetBrowserAtIndex(int index) const;
+
+ // Creates and returns a new Browser instance.
+ Browser* CreateNewBrowser();
+
+ // Closes the Browser at the specified index.
+ void CloseBrowserAtIndex(int index);
+
+ private:
+ std::vector<std::unique_ptr<Browser>> browsers_;
+ ios::ChromeBrowserState* browser_state_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserList);
+};
+
+#endif // IOS_CLEAN_CHROME_BROWSER_MODEL_BROWSER_LIST_H_
« no previous file with comments | « ios/clean/chrome/browser/model/browser.mm ('k') | ios/clean/chrome/browser/model/browser_list.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698