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

Unified Diff: ios/shared/chrome/browser/tabs/web_state_list.h

Issue 2640093004: WebStateList is an array of web::WebState* wrappers. (Closed)
Patch Set: Fix leaks (caught by unit tests). Created 3 years, 11 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/shared/chrome/browser/tabs/web_state_handle.h ('k') | ios/shared/chrome/browser/tabs/web_state_list.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/shared/chrome/browser/tabs/web_state_list.h
diff --git a/ios/shared/chrome/browser/tabs/web_state_list.h b/ios/shared/chrome/browser/tabs/web_state_list.h
new file mode 100644
index 0000000000000000000000000000000000000000..5aff6ef90fbf352561d4d09bdac8f48f54bd7f3e
--- /dev/null
+++ b/ios/shared/chrome/browser/tabs/web_state_list.h
@@ -0,0 +1,53 @@
+// 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_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_H_
+#define IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_H_
+
+#import <Foundation/Foundation.h>
+
+@protocol WebStateHandle;
+
+// Clang format incorrectly formats the <__covariant ObjectType> used
+// to declare WebStateList as a lighweight generic class. Disable it
+// until the underlying issue is fixed (b/34375672).
+// clang-format off
+
+// A generic array of WebStateHandles.
+@interface WebStateList<__covariant ObjectType: id<WebStateHandle>>
+ : NSObject<NSFastEnumeration>
+
+// The number of objects in the array.
+@property(nonatomic, readonly) NSUInteger count;
+
+// The first WebStateHandle in the array.
+@property(nonatomic, readonly) ObjectType firstWebState;
+
+// Inserts |webState| at the end of the array.
+- (void)addWebState:(ObjectType)webState;
+
+// Inserts |webState| into the array at |index|.
+- (void)insertWebState:(ObjectType)webState atIndex:(NSUInteger)index;
+
+// Replaces the WebStateHandle at |index| with |webState|.
+- (void)replaceWebStateAtIndex:(NSUInteger)index
+ withWebState:(ObjectType)webState;
+
+// Removes all occurrences of |webState| in the array.
+- (void)removeWebState:(ObjectType)webState;
+
+// Returns YES if |webState| is in the array.
+- (BOOL)containsWebState:(ObjectType)webState;
+
+// Returns the WebStateHandle at |index|.
+- (ObjectType)webStateAtIndex:(NSUInteger)index;
+
+// Returns the lowest index whose value is equal to |webState|.
+- (NSUInteger)indexOfWebState:(ObjectType)webState;
+
+@end
+
+// clang-format on
+
+#endif // IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_H_
« no previous file with comments | « ios/shared/chrome/browser/tabs/web_state_handle.h ('k') | ios/shared/chrome/browser/tabs/web_state_list.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698