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_DELEGATE_H_ | 5 #ifndef IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_DELEGATE_H_ |
6 #define IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_DELEGATE_H_ | 6 #define IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_DELEGATE_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 | 9 |
10 namespace web { | 10 namespace web { |
11 class WebState; | 11 class WebState; |
12 } | 12 } |
13 | 13 |
14 // A delegate interface that the WebStateList uses to perform work that it | 14 // A delegate interface that the WebStateList uses to perform work that it |
15 // cannot do itself such as attaching tab helpers, ... | 15 // cannot do itself such as attaching tab helpers, ... |
16 class WebStateListDelegate { | 16 class WebStateListDelegate { |
17 public: | 17 public: |
18 WebStateListDelegate() = default; | 18 WebStateListDelegate() = default; |
19 virtual ~WebStateListDelegate() = default; | 19 virtual ~WebStateListDelegate() = default; |
20 | 20 |
21 // Notifies the delegate that the specified WebState will be added to the | 21 // Notifies the delegate that the specified WebState will be added to the |
22 // WebStateList (via insertion/appending/replacing existing) and allows it | 22 // WebStateList (via insertion/appending/replacing existing) and allows it |
23 // to do any preparation that it deems necessary. | 23 // to do any preparation that it deems necessary. |
24 virtual void WillAddWebState(web::WebState* web_state) = 0; | 24 virtual void WillAddWebState(web::WebState* web_state) = 0; |
25 | 25 |
| 26 // Notifies the delegate that the specified WebState has been detached from |
| 27 // the WebStateList (via detaching/closing/replacing existing) and allows it |
| 28 // to do any clean up that it deems necessary. |
| 29 virtual void WebStateDetached(web::WebState* web_state) = 0; |
| 30 |
26 private: | 31 private: |
27 DISALLOW_COPY_AND_ASSIGN(WebStateListDelegate); | 32 DISALLOW_COPY_AND_ASSIGN(WebStateListDelegate); |
28 }; | 33 }; |
29 | 34 |
30 #endif // IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_DELEGATE_H_ | 35 #endif // IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_DELEGATE_H_ |
OLD | NEW |