| 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) {}
|
|
|