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_OBSERVER_H_ |
| 6 #define IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_OBSERVER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 |
| 10 class WebStateList; |
| 11 |
| 12 namespace web { |
| 13 class WebState; |
| 14 } |
| 15 |
| 16 // Interface for listening to events occurring to WebStateLists. |
| 17 class WebStateListObserver { |
| 18 public: |
| 19 WebStateListObserver(); |
| 20 virtual ~WebStateListObserver(); |
| 21 |
| 22 // Invoked after a new WebState has been added to the WebStateList at the |
| 23 // specified index. |
| 24 virtual void WebStateInsertedAt(WebStateList* web_state_list, |
| 25 web::WebState* web_state, |
| 26 int index); |
| 27 |
| 28 // Invoked after the WebState at the specified index is moved to another |
| 29 // index. |
| 30 virtual void WebStateMoved(WebStateList* web_state_list, |
| 31 web::WebState* web_state, |
| 32 int from_index, |
| 33 int to_index); |
| 34 |
| 35 // Invoked after the WebState at the specified index is replaced by another |
| 36 // WebState. |
| 37 virtual void WebStateReplacedAt(WebStateList* web_state_list, |
| 38 web::WebState* old_web_state, |
| 39 web::WebState* new_web_state, |
| 40 int index); |
| 41 |
| 42 // Invoked before the specified WebState is detached from the WebStateList. |
| 43 // The WebState is still valid and still in the WebStateList. |
| 44 virtual void WillDetachWebStateAt(WebStateList* web_state_list, |
| 45 web::WebState* web_state, |
| 46 int index); |
| 47 |
| 48 // Invoked after the WebState at the specified index has been detached. The |
| 49 // WebState is still valid but is no longer in the WebStateList. |
| 50 virtual void WebStateDetachedAt(WebStateList* web_state_list, |
| 51 web::WebState* web_state, |
| 52 int index); |
| 53 |
| 54 // Invoked before the specified WebState is destroyed via the WebStateList. |
| 55 // The WebState is still valid but is no longer in the WebStateList. |
| 56 virtual void WillCloseWebStateAt(WebStateList* web_state_list, |
| 57 web::WebState* web_state, |
| 58 int index); |
| 59 |
| 60 // Invoked after |new_web_state| was activated at the specified index. Both |
| 61 // WebState are either valid or null (if there was no selection or there is |
| 62 // no selection). If the change is due to an user action, |user_action| will |
| 63 // be true. |
| 64 virtual void WebStateActivatedAt(WebStateList* web_state_list, |
| 65 web::WebState* old_web_state, |
| 66 web::WebState* new_web_state, |
| 67 int active_index, |
| 68 bool user_action); |
| 69 |
| 70 private: |
| 71 DISALLOW_COPY_AND_ASSIGN(WebStateListObserver); |
| 72 }; |
| 73 |
| 74 #endif // IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_OBSERVER_H_ |
OLD | NEW |