OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_OBSERVER_H_ | 5 #ifndef IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_OBSERVER_H_ |
6 #define IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_OBSERVER_H_ | 6 #define IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_OBSERVER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 | 9 |
10 class WebStateList; | 10 class WebStateList; |
11 | 11 |
12 namespace web { | 12 namespace web { |
13 class WebState; | 13 class WebState; |
14 } | 14 } |
15 | 15 |
16 // Interface for listening to events occurring to WebStateLists. | 16 // Interface for listening to events occurring to WebStateLists. |
17 class WebStateListObserver { | 17 class WebStateListObserver { |
18 public: | 18 public: |
19 WebStateListObserver() = default; | 19 WebStateListObserver(); |
20 virtual ~WebStateListObserver() = default; | 20 virtual ~WebStateListObserver(); |
21 | 21 |
22 // Invoked after a new WebState has been added to the WebStateList at the | 22 // Invoked after a new WebState has been added to the WebStateList at the |
23 // specified index. | 23 // specified index. |
24 virtual void WebStateInsertedAt(WebStateList* web_state_list, | 24 virtual void WebStateInsertedAt(WebStateList* web_state_list, |
25 web::WebState* web_state, | 25 web::WebState* web_state, |
26 int index) = 0; | 26 int index); |
27 | 27 |
28 // Invoked after the WebState at the specified index is moved to another | 28 // Invoked after the WebState at the specified index is moved to another |
29 // index. | 29 // index. |
30 virtual void WebStateMoved(WebStateList* web_state_list, | 30 virtual void WebStateMoved(WebStateList* web_state_list, |
31 web::WebState* web_state, | 31 web::WebState* web_state, |
32 int from_index, | 32 int from_index, |
33 int to_index) = 0; | 33 int to_index); |
34 | 34 |
35 // Invoked after the WebState at the specified index is replaced by another | 35 // Invoked after the WebState at the specified index is replaced by another |
36 // WebState. | 36 // WebState. |
37 virtual void WebStateReplacedAt(WebStateList* web_state_list, | 37 virtual void WebStateReplacedAt(WebStateList* web_state_list, |
38 web::WebState* old_web_state, | 38 web::WebState* old_web_state, |
39 web::WebState* new_web_state, | 39 web::WebState* new_web_state, |
40 int index) = 0; | 40 int index); |
41 | 41 |
42 // Invoked after the WebState at the specified index has been detached. The | 42 // Invoked after the WebState at the specified index has been detached. The |
43 // WebState is still valid but is no longer in the WebStateList. | 43 // WebState is still valid but is no longer in the WebStateList. |
44 virtual void WebStateDetachedAt(WebStateList* web_state_list, | 44 virtual void WebStateDetachedAt(WebStateList* web_state_list, |
45 web::WebState* web_state, | 45 web::WebState* web_state, |
46 int index) = 0; | 46 int index); |
47 | 47 |
48 private: | 48 private: |
49 DISALLOW_COPY_AND_ASSIGN(WebStateListObserver); | 49 DISALLOW_COPY_AND_ASSIGN(WebStateListObserver); |
50 }; | 50 }; |
51 | 51 |
52 #endif // IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_OBSERVER_H_ | 52 #endif // IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_OBSERVER_H_ |
OLD | NEW |