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

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

Issue 2687303003: Convert some of TabModel logic to WebStateListObservers. (Closed)
Patch Set: 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/chrome/browser/tabs/tab_model_tab_parenting_observer.mm
diff --git a/ios/chrome/browser/tabs/tab_model_tab_parenting_observer.mm b/ios/chrome/browser/tabs/tab_model_tab_parenting_observer.mm
new file mode 100644
index 0000000000000000000000000000000000000000..8f85c73c89dfb7c1e747c54e13ec34bc0c35aff3
--- /dev/null
+++ b/ios/chrome/browser/tabs/tab_model_tab_parenting_observer.mm
@@ -0,0 +1,40 @@
+// 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_model_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
+
+@implementation TabModelTabParentingObserver
+
+#pragma mark WebStateListObserver
+
+- (void)webStateList:(WebStateList*)webStateList
+ webStateInserted:(web::WebState*)webState
+ atIndex:(NSUInteger)index {
+ [self parentedWebState:webState];
+}
+
+- (void)webStateList:(WebStateList*)webStateList
+ webStateReplaced:(web::WebState*)oldWebState
+ byWebState:(web::WebState*)newWebState
+ atIndex:(NSUInteger)index {
+ [self parentedWebState:newWebState];
+}
+
+#pragma mark Private methods
+
+- (void)parentedWebState:(web::WebState*)webState {
+ TabParentingGlobalObserver::GetInstance()->OnTabParented(webState);
+ Tab* tab = LegacyTabHelper::GetTabForWebState(webState);
+ [tab fetchFavicon];
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698