| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_H_ |
| 6 #define IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 @protocol WebStateHandle; |
| 11 |
| 12 // Clang format incorrectly formats the <__covariant ObjectType> used |
| 13 // to declare WebStateList as a lighweight generic class. Disable it |
| 14 // until the underlying issue is fixed (b/34375672). |
| 15 // clang-format off |
| 16 |
| 17 // A generic array of WebStateHandles. |
| 18 @interface WebStateList<__covariant ObjectType: id<WebStateHandle>> |
| 19 : NSObject<NSFastEnumeration> |
| 20 |
| 21 // The number of objects in the array. |
| 22 @property(nonatomic, readonly) NSUInteger count; |
| 23 |
| 24 // The first WebStateHandle in the array. |
| 25 @property(nonatomic, readonly) ObjectType firstWebState; |
| 26 |
| 27 // Inserts |webState| at the end of the array. |
| 28 - (void)addWebState:(ObjectType)webState; |
| 29 |
| 30 // Inserts |webState| into the array at |index|. |
| 31 - (void)insertWebState:(ObjectType)webState atIndex:(NSUInteger)index; |
| 32 |
| 33 // Replaces the WebStateHandle at |index| with |webState|. |
| 34 - (void)replaceWebStateAtIndex:(NSUInteger)index |
| 35 withWebState:(ObjectType)webState; |
| 36 |
| 37 // Removes all occurrences of |webState| in the array. |
| 38 - (void)removeWebState:(ObjectType)webState; |
| 39 |
| 40 // Returns YES if |webState| is in the array. |
| 41 - (BOOL)containsWebState:(ObjectType)webState; |
| 42 |
| 43 // Returns the WebStateHandle at |index|. |
| 44 - (ObjectType)webStateAtIndex:(NSUInteger)index; |
| 45 |
| 46 // Returns the lowest index whose value is equal to |webState|. |
| 47 - (NSUInteger)indexOfWebState:(ObjectType)webState; |
| 48 |
| 49 @end |
| 50 |
| 51 // clang-format on |
| 52 |
| 53 #endif // IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_H_ |
| OLD | NEW |