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

Unified Diff: ios/chrome/browser/tabs/tab_parenting_observer.mm

Issue 2687303003: Convert some of TabModel logic to WebStateListObservers. (Closed)
Patch Set: Rebase. 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
« no previous file with comments | « ios/chrome/browser/tabs/tab_parenting_observer.h ('k') | ios/shared/chrome/browser/tabs/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/tabs/tab_parenting_observer.mm
diff --git a/ios/chrome/browser/tabs/tab_parenting_observer.mm b/ios/chrome/browser/tabs/tab_parenting_observer.mm
new file mode 100644
index 0000000000000000000000000000000000000000..4dbcef482897676e8f631ffb2351961206604c4c
--- /dev/null
+++ b/ios/chrome/browser/tabs/tab_parenting_observer.mm
@@ -0,0 +1,47 @@
+// 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.
+
+#import "ios/chrome/browser/tabs/tab_parenting_observer.h"
+
+#include "ios/chrome/browser/tab_parenting_global_observer.h"
+#import "ios/chrome/browser/tabs/legacy_tab_helper.h"
+#import "ios/chrome/browser/tabs/tab.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+namespace {
+void OnWebStateParented(web::WebState* web_state) {
+ TabParentingGlobalObserver::GetInstance()->OnTabParented(web_state);
+ Tab* tab = LegacyTabHelper::GetTabForWebState(web_state);
+ [tab fetchFavicon];
+}
+} // namespace
+
+TabParentingObserver::TabParentingObserver() = default;
+
+TabParentingObserver::~TabParentingObserver() = default;
+
+void TabParentingObserver::WebStateInsertedAt(WebStateList* web_state_list,
+ web::WebState* web_state,
+ int index) {
+ OnWebStateParented(web_state);
+}
+
+void TabParentingObserver::WebStateMoved(WebStateList* web_state_list,
+ web::WebState* web_state,
+ int from_index,
+ int to_index) {}
+
+void TabParentingObserver::WebStateReplacedAt(WebStateList* web_state_list,
+ web::WebState* old_web_state,
+ web::WebState* new_web_state,
+ int index) {
+ OnWebStateParented(new_web_state);
+}
+
+void TabParentingObserver::WebStateDetachedAt(WebStateList* web_state_list,
+ web::WebState* web_state,
+ int index) {}
« no previous file with comments | « ios/chrome/browser/tabs/tab_parenting_observer.h ('k') | ios/shared/chrome/browser/tabs/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698