Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(925)

Unified Diff: ios/shared/chrome/browser/tabs/web_state_list_observer.h

Issue 2680403005: Introduce WebStateList to manage a list of web::WebState. (Closed)
Patch Set: Fix "gn check". Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/shared/chrome/browser/tabs/web_state_list_observer.h
diff --git a/ios/shared/chrome/browser/tabs/web_state_list_observer.h b/ios/shared/chrome/browser/tabs/web_state_list_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..6b91809bd169a57b4e301ccdbf8c67801e7aec4d
--- /dev/null
+++ b/ios/shared/chrome/browser/tabs/web_state_list_observer.h
@@ -0,0 +1,51 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_OBSERVER_H_
+#define IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_OBSERVER_H_
+
+#include "base/macros.h"
+
+class WebStateList;
+
+namespace web {
+class WebState;
+}
+
+// Interface for listening to events occurring to WebStateLists.
+class WebStateListObserver {
+ public:
+ WebStateListObserver() = default;
+ virtual ~WebStateListObserver() = default;
+
+ // Invoked when a new WebState has been added to the WebStateList at the
+ // specified index.
+ virtual void WebStateInsertedAt(WebStateList* web_state_list,
+ web::WebState* web_state,
+ size_t index) = 0;
+
+ // Invoked when the WebState at the specified index is moved to another index.
rohitrao (ping after 24h) 2017/02/13 20:54:29 Is this called before or after the move? Is that
sdefresne 2017/02/14 13:39:57 After, I've updated the documentation.
+ virtual void WebStateMoved(WebStateList* web_state_list,
+ web::WebState* web_state,
+ size_t from_index,
+ size_t to_index) = 0;
+
+ // Invoked when the WebState at the specified index is replaced by another
rohitrao (ping after 24h) 2017/02/13 20:54:29 Is this called before or after the replacement? I
sdefresne 2017/02/14 13:39:57 After, I've updated the documentation.
+ // WebState.
+ virtual void WebStateReplacedAt(WebStateList* web_state_list,
+ web::WebState* old_web_state,
+ web::WebState* new_web_state,
+ size_t index) = 0;
+
+ // Invoked when the WebState at the specified index is being removed. The
+ // WebState is still valid but is no longer in the WebStateList.
+ virtual void WebStateRemovedAt(WebStateList* web_state_list,
rohitrao (ping after 24h) 2017/02/13 20:54:29 Is there value in calling this "Detached" instead
sdefresne 2017/02/14 13:39:57 Done.
+ web::WebState* web_state,
+ size_t index) = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(WebStateListObserver);
+};
+
+#endif // IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_OBSERVER_H_

Powered by Google App Engine
This is Rietveld 408576698