| 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
|
|
|