OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/browser/tabs/tab_model_tab_parenting_observer.h" |
| 6 |
| 7 #include "ios/chrome/browser/tab_parenting_global_observer.h" |
| 8 #import "ios/chrome/browser/tabs/legacy_tab_helper.h" |
| 9 #import "ios/chrome/browser/tabs/tab.h" |
| 10 |
| 11 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 12 #error "This file requires ARC support." |
| 13 #endif |
| 14 |
| 15 @implementation TabModelTabParentingObserver |
| 16 |
| 17 #pragma mark WebStateListObserver |
| 18 |
| 19 - (void)webStateList:(WebStateList*)webStateList |
| 20 webStateInserted:(web::WebState*)webState |
| 21 atIndex:(NSUInteger)index { |
| 22 [self parentedWebState:webState]; |
| 23 } |
| 24 |
| 25 - (void)webStateList:(WebStateList*)webStateList |
| 26 webStateReplaced:(web::WebState*)oldWebState |
| 27 byWebState:(web::WebState*)newWebState |
| 28 atIndex:(NSUInteger)index { |
| 29 [self parentedWebState:newWebState]; |
| 30 } |
| 31 |
| 32 #pragma mark Private methods |
| 33 |
| 34 - (void)parentedWebState:(web::WebState*)webState { |
| 35 TabParentingGlobalObserver::GetInstance()->OnTabParented(webState); |
| 36 Tab* tab = LegacyTabHelper::GetTabForWebState(webState); |
| 37 [tab fetchFavicon]; |
| 38 } |
| 39 |
| 40 @end |
OLD | NEW |