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 |
index 5964e01069e1a13b13939370495e6a624eaa765a..b55daa7c7ec96c9b42c62f15f30e07dbdea4ef27 100644 |
--- a/ios/shared/chrome/browser/tabs/web_state_list.h |
+++ b/ios/shared/chrome/browser/tabs/web_state_list.h |
@@ -47,16 +47,41 @@ class WebStateList { |
// WebState is not in the model. |
int GetIndexOfWebState(const web::WebState* web_state) const; |
- // Inserts the specified WebState at the specified index. |
- void InsertWebState(int index, web::WebState* web_state); |
+ // Returns the WebState that opened the WebState at the specified index or |
+ // null if there is no opener on record. |
+ web::WebState* GetOpenerOfWebStateAt(int index) const; |
+ |
+ // Returns the index of the next WebState in the sequence of WebStates opened |
+ // from the specified WebState after |start_index|, or kInvalidIndex if there |
+ // are no such WebState. If |use_group| is true, the opener's navigation index |
+ // is used to detect navigation changes within the same session. |
+ int GetIndexOfNextWebStateOpenedBy(const web::WebState* opener, |
+ int start_index, |
+ bool use_group) const; |
+ |
+ // Returns the index of the last WebState in the sequence of WebStates opened |
+ // from the specified WebState after |start_index|, or kInvalidIndex if there |
+ // are no such WebState. If |use_group| is true, the opener's navigation index |
+ // is used to detect navigation changes within the same session. |
+ int GetIndexOfLastWebStateOpenedBy(const web::WebState* opener, |
+ int start_index, |
+ bool use_group) const; |
+ |
+ // Inserts the specified WebState at the specified index with an optional |
+ // opener (null if there is no opener). |
+ void InsertWebState(int index, |
+ web::WebState* web_state, |
+ web::WebState* opener); |
// Moves the WebState at the specified index to another index. |
void MoveWebStateAt(int from_index, int to_index); |
// Replaces the WebState at the specified index with new WebState. Returns |
// the old WebState at that index to the caller (abandon ownership of the |
- // returned WebState). |
- web::WebState* ReplaceWebStateAt(int index, web::WebState* web_state); |
+ // returned WebState). An optional opener for the new WebState may be passed. |
+ web::WebState* ReplaceWebStateAt(int index, |
+ web::WebState* web_state, |
+ web::WebState* opener); |
// Detaches the WebState at the specified index. |
void DetachWebStateAt(int index); |
@@ -71,6 +96,22 @@ class WebStateList { |
static const int kInvalidIndex = -1; |
private: |
+ // Sets the opener for WebState at the specified index. |
+ void SetOpenerOfWebStateAt(int index, web::WebState* opener); |
+ |
+ // Sets the opener of any WebState that reference the WebState at the |
+ // specified index to null. |
+ void FixOpenersReferencing(int index); |
+ |
+ // Returns the index of the n-th WebState in the sequence of WebStates opened |
+ // from the specified WebState after |start_index|, or kInvalidIndex if there |
+ // are no such WebState. If |use_group| is true, the opener's navigation index |
+ // is used to detect navigation changes within the same session. |
+ int GetIndexOfNthWebStateOpenedBy(const web::WebState* opener, |
+ int start_index, |
+ int skip_up_to, |
marq (ping after 24h)
2017/02/16 15:19:17
Can you document how |skip_up_to| relates to the '
sdefresne
2017/02/16 15:42:01
Renamed the parameter to n as discussed offline, a
|
+ bool use_group) const; |
+ |
class WebStateWrapper; |
const WebStateOwnership web_state_ownership_; |
std::vector<std::unique_ptr<WebStateWrapper>> web_state_wrappers_; |