| 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 | 14 |
| 14 class WebStateListObserver; | 15 class WebStateListObserver; |
| 15 | 16 |
| 16 namespace web { | 17 namespace web { |
| 17 class WebState; | 18 class WebState; |
| 18 } | 19 } |
| 19 | 20 |
| 20 // Manages a list of WebStates. May owns the WebState depending on the ownership | 21 // Manages a list of WebStates. May owns the WebState depending on the ownership |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 web::WebState* opener); | 79 web::WebState* opener); |
| 79 | 80 |
| 80 // Moves the WebState at the specified index to another index. | 81 // Moves the WebState at the specified index to another index. |
| 81 void MoveWebStateAt(int from_index, int to_index); | 82 void MoveWebStateAt(int from_index, int to_index); |
| 82 | 83 |
| 83 // Replaces the WebState at the specified index with new WebState. Returns | 84 // Replaces the WebState at the specified index with new WebState. Returns |
| 84 // the old WebState at that index to the caller (abandon ownership of the | 85 // the old WebState at that index to the caller (abandon ownership of the |
| 85 // returned WebState). An optional opener for the new WebState may be passed. | 86 // returned WebState). An optional opener for the new WebState may be passed. |
| 86 web::WebState* ReplaceWebStateAt(int index, | 87 web::WebState* ReplaceWebStateAt(int index, |
| 87 web::WebState* web_state, | 88 web::WebState* web_state, |
| 88 web::WebState* opener); | 89 web::WebState* opener) WARN_UNUSED_RESULT; |
| 89 | 90 |
| 90 // Detaches the WebState at the specified index. | 91 // Detaches the WebState at the specified index. Returns the detached WebState |
| 91 void DetachWebStateAt(int index); | 92 // to the caller (abandon ownership of the returned WebState). |
| 93 web::WebState* DetachWebStateAt(int index) WARN_UNUSED_RESULT; |
| 92 | 94 |
| 93 // Adds an observer to the model. | 95 // Adds an observer to the model. |
| 94 void AddObserver(WebStateListObserver* observer); | 96 void AddObserver(WebStateListObserver* observer); |
| 95 | 97 |
| 96 // Removes an observer from the model. | 98 // Removes an observer from the model. |
| 97 void RemoveObserver(WebStateListObserver* observer); | 99 void RemoveObserver(WebStateListObserver* observer); |
| 98 | 100 |
| 99 // Invalid index. | 101 // Invalid index. |
| 100 static const int kInvalidIndex = -1; | 102 static const int kInvalidIndex = -1; |
| 101 | 103 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 118 const WebStateOwnership web_state_ownership_; | 120 const WebStateOwnership web_state_ownership_; |
| 119 std::vector<std::unique_ptr<WebStateWrapper>> web_state_wrappers_; | 121 std::vector<std::unique_ptr<WebStateWrapper>> web_state_wrappers_; |
| 120 | 122 |
| 121 // List of observers notified of changes to the model. | 123 // List of observers notified of changes to the model. |
| 122 base::ObserverList<WebStateListObserver, true> observers_; | 124 base::ObserverList<WebStateListObserver, true> observers_; |
| 123 | 125 |
| 124 DISALLOW_COPY_AND_ASSIGN(WebStateList); | 126 DISALLOW_COPY_AND_ASSIGN(WebStateList); |
| 125 }; | 127 }; |
| 126 | 128 |
| 127 #endif // IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_H_ | 129 #endif // IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_H_ |
| OLD | NEW |