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_H_ | 5 #ifndef IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_H_ |
6 #define IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_H_ | 6 #define IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
| 11 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
13 #include "ui/base/page_transition_types.h" | 14 #include "ui/base/page_transition_types.h" |
14 | 15 |
15 class WebStateListObserver; | 16 class WebStateListObserver; |
16 class WebStateListOrderController; | 17 class WebStateListOrderController; |
17 | 18 |
18 namespace web { | 19 namespace web { |
19 class WebState; | 20 class WebState; |
20 } | 21 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 web::WebState* opener); | 88 web::WebState* opener); |
88 | 89 |
89 // Moves the WebState at the specified index to another index. | 90 // Moves the WebState at the specified index to another index. |
90 void MoveWebStateAt(int from_index, int to_index); | 91 void MoveWebStateAt(int from_index, int to_index); |
91 | 92 |
92 // Replaces the WebState at the specified index with new WebState. Returns | 93 // Replaces the WebState at the specified index with new WebState. Returns |
93 // the old WebState at that index to the caller (abandon ownership of the | 94 // the old WebState at that index to the caller (abandon ownership of the |
94 // returned WebState). An optional opener for the new WebState may be passed. | 95 // returned WebState). An optional opener for the new WebState may be passed. |
95 web::WebState* ReplaceWebStateAt(int index, | 96 web::WebState* ReplaceWebStateAt(int index, |
96 web::WebState* web_state, | 97 web::WebState* web_state, |
97 web::WebState* opener); | 98 web::WebState* opener) WARN_UNUSED_RESULT; |
98 | 99 |
99 // Detaches the WebState at the specified index. | 100 // Detaches the WebState at the specified index. Returns the detached WebState |
100 void DetachWebStateAt(int index); | 101 // to the caller (abandon ownership of the returned WebState). |
| 102 web::WebState* DetachWebStateAt(int index) WARN_UNUSED_RESULT; |
101 | 103 |
102 // Adds an observer to the model. | 104 // Adds an observer to the model. |
103 void AddObserver(WebStateListObserver* observer); | 105 void AddObserver(WebStateListObserver* observer); |
104 | 106 |
105 // Removes an observer from the model. | 107 // Removes an observer from the model. |
106 void RemoveObserver(WebStateListObserver* observer); | 108 void RemoveObserver(WebStateListObserver* observer); |
107 | 109 |
108 // Invalid index. | 110 // Invalid index. |
109 static const int kInvalidIndex = -1; | 111 static const int kInvalidIndex = -1; |
110 | 112 |
(...skipping 20 matching lines...) Expand all Loading... |
131 // selection should move when a WebState is detached. | 133 // selection should move when a WebState is detached. |
132 std::unique_ptr<WebStateListOrderController> order_controller_; | 134 std::unique_ptr<WebStateListOrderController> order_controller_; |
133 | 135 |
134 // List of observers notified of changes to the model. | 136 // List of observers notified of changes to the model. |
135 base::ObserverList<WebStateListObserver, true> observers_; | 137 base::ObserverList<WebStateListObserver, true> observers_; |
136 | 138 |
137 DISALLOW_COPY_AND_ASSIGN(WebStateList); | 139 DISALLOW_COPY_AND_ASSIGN(WebStateList); |
138 }; | 140 }; |
139 | 141 |
140 #endif // IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_H_ | 142 #endif // IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_H_ |
OLD | NEW |