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 b8bc5d3b32fdd28e5f61acb443a2610ab4e14b37..ba3e9b8bf0bcdf696e0ff48bd3cac1701a59152f 100644 |
--- a/ios/shared/chrome/browser/tabs/web_state_list.h |
+++ b/ios/shared/chrome/browser/tabs/web_state_list.h |
@@ -39,9 +39,16 @@ class WebStateList { |
// Returns the number of WebStates in the model. |
int count() const { return static_cast<int>(web_state_wrappers_.size()); } |
+ // Returns the index of the currently active WebState, or kInvalidIndex if |
+ // there are no active WebState. |
+ int active_index() const { return active_index_; } |
+ |
// Returns true if the specified index is contained by the model. |
bool ContainsIndex(int index) const; |
+ // Returns the currently active WebState or null if there is none. |
+ web::WebState* GetActiveWebState() const; |
+ |
// Returns the WebState at the specified index. It is invalid to call this |
// with an index such that |ContainsIndex(index)| returns false. |
web::WebState* GetWebStateAt(int index) const; |
@@ -101,6 +108,9 @@ class WebStateList { |
// to the caller (abandon ownership of the returned WebState). |
web::WebState* DetachWebStateAt(int index) WARN_UNUSED_RESULT; |
+ // Makes the WebState at the specified index the active WebState. |
+ void ActivateWebStateAt(int index); |
+ |
// Adds an observer to the model. |
void AddObserver(WebStateListObserver* observer); |
@@ -115,6 +125,10 @@ class WebStateList { |
// specified index to null. |
void ClearOpenersReferencing(int index); |
+ // Notify the observers if the active WebState change. |
+ void NotifyIfActiveWebStateChanged(web::WebState* old_web_state, |
+ bool user_action); |
+ |
// Returns the index of the |n|-th WebState (with n > 0) 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 |
@@ -136,6 +150,9 @@ class WebStateList { |
// List of observers notified of changes to the model. |
base::ObserverList<WebStateListObserver, true> observers_; |
+ // Index of the currently active WebState, kInvalidIndex if no such WebState. |
+ int active_index_ = kInvalidIndex; |
+ |
DISALLOW_COPY_AND_ASSIGN(WebStateList); |
}; |