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

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

Issue 2640093004: WebStateList is an array of web::WebState* wrappers. (Closed)
Patch Set: 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
Index: ios/chrome/browser/tabs/web_state_list.h
diff --git a/ios/chrome/browser/tabs/web_state_list.h b/ios/chrome/browser/tabs/web_state_list.h
new file mode 100644
index 0000000000000000000000000000000000000000..4cea8d3fcf99e313db87cf265782ad18014900ad
--- /dev/null
+++ b/ios/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_CHROME_BROWSER_TABS_WEB_STATE_LIST_H_
+#define IOS_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)webSate;
marq (ping after 24h) 2017/01/19 13:37:46 webSate -> webState
sdefresne 2017/01/20 14:42:09 Done.
+
+// 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_CHROME_BROWSER_TABS_WEB_STATE_LIST_H_

Powered by Google App Engine
This is Rietveld 408576698