| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ios/chrome/browser/tabs/tab_helper_util.h" | 5 #import "ios/chrome/browser/tabs/tab_helper_util.h" |
| 6 | 6 |
| 7 #if !defined(__has_feature) || !__has_feature(objc_arc) | 7 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 8 #error "This file requires ARC support." | 8 #error "This file requires ARC support." |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #import "ios/chrome/browser/infobars/infobar_manager_impl.h" | 22 #import "ios/chrome/browser/infobars/infobar_manager_impl.h" |
| 23 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" | 23 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" |
| 24 #import "ios/chrome/browser/reading_list/reading_list_web_state_observer.h" | 24 #import "ios/chrome/browser/reading_list/reading_list_web_state_observer.h" |
| 25 #import "ios/chrome/browser/sessions/ios_chrome_session_tab_helper.h" | 25 #import "ios/chrome/browser/sessions/ios_chrome_session_tab_helper.h" |
| 26 #import "ios/chrome/browser/signin/account_consistency_service_factory.h" | 26 #import "ios/chrome/browser/signin/account_consistency_service_factory.h" |
| 27 #import "ios/chrome/browser/ssl/ios_security_state_tab_helper.h" | 27 #import "ios/chrome/browser/ssl/ios_security_state_tab_helper.h" |
| 28 #import "ios/chrome/browser/store_kit/store_kit_tab_helper.h" | 28 #import "ios/chrome/browser/store_kit/store_kit_tab_helper.h" |
| 29 #import "ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h" | 29 #import "ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h" |
| 30 #import "ios/chrome/browser/tabs/legacy_tab_helper.h" | 30 #import "ios/chrome/browser/tabs/legacy_tab_helper.h" |
| 31 #import "ios/chrome/browser/tabs/tab.h" | 31 #import "ios/chrome/browser/tabs/tab.h" |
| 32 #import "ios/chrome/browser/tabs/tab_private.h" |
| 32 #import "ios/chrome/browser/translate/chrome_ios_translate_client.h" | 33 #import "ios/chrome/browser/translate/chrome_ios_translate_client.h" |
| 33 #import "ios/chrome/browser/web/blocked_popup_tab_helper.h" | 34 #import "ios/chrome/browser/web/blocked_popup_tab_helper.h" |
| 34 #import "ios/chrome/browser/web/network_activity_indicator_tab_helper.h" | 35 #import "ios/chrome/browser/web/network_activity_indicator_tab_helper.h" |
| 35 #import "ios/chrome/browser/web/repost_form_tab_helper.h" | 36 #import "ios/chrome/browser/web/repost_form_tab_helper.h" |
| 36 #import "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 37 #import "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
| 37 #import "ios/web/public/web_state/web_state.h" | 38 #import "ios/web/public/web_state/web_state.h" |
| 38 | 39 |
| 39 void AttachTabHelpers(web::WebState* web_state) { | 40 void AttachTabHelpers(web::WebState* web_state) { |
| 41 LegacyTabHelper::CreateForWebState(web_state); |
| 40 Tab* tab = LegacyTabHelper::GetTabForWebState(web_state); | 42 Tab* tab = LegacyTabHelper::GetTabForWebState(web_state); |
| 43 DCHECK(tab); |
| 41 | 44 |
| 42 ios::ChromeBrowserState* browser_state = | 45 ios::ChromeBrowserState* browser_state = |
| 43 ios::ChromeBrowserState::FromBrowserState(web_state->GetBrowserState()); | 46 ios::ChromeBrowserState::FromBrowserState(web_state->GetBrowserState()); |
| 44 | 47 |
| 45 // IOSChromeSessionTabHelper comes first because it sets up the tab ID, | 48 // IOSChromeSessionTabHelper comes first because it sets up the tab ID, |
| 46 // and other helpers may rely on that. | 49 // and other helpers may rely on that. |
| 47 IOSChromeSessionTabHelper::CreateForWebState(web_state); | 50 IOSChromeSessionTabHelper::CreateForWebState(web_state); |
| 48 | 51 |
| 49 NetworkActivityIndicatorTabHelper::CreateForWebState(web_state, tab.tabId); | 52 NetworkActivityIndicatorTabHelper::CreateForWebState(web_state, tab.tabId); |
| 50 IOSChromeSyncedTabDelegate::CreateForWebState(web_state); | 53 IOSChromeSyncedTabDelegate::CreateForWebState(web_state); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 74 original_browser_state, ServiceAccessType::IMPLICIT_ACCESS), | 77 original_browser_state, ServiceAccessType::IMPLICIT_ACCESS), |
| 75 ios::HistoryServiceFactory::GetForBrowserState( | 78 ios::HistoryServiceFactory::GetForBrowserState( |
| 76 original_browser_state, ServiceAccessType::IMPLICIT_ACCESS), | 79 original_browser_state, ServiceAccessType::IMPLICIT_ACCESS), |
| 77 ios::BookmarkModelFactory::GetForBrowserState(original_browser_state)); | 80 ios::BookmarkModelFactory::GetForBrowserState(original_browser_state)); |
| 78 history::WebStateTopSitesObserver::CreateForWebState( | 81 history::WebStateTopSitesObserver::CreateForWebState( |
| 79 web_state, | 82 web_state, |
| 80 ios::TopSitesFactory::GetForBrowserState(original_browser_state).get()); | 83 ios::TopSitesFactory::GetForBrowserState(original_browser_state).get()); |
| 81 | 84 |
| 82 // Allow the embedder to attach tab helpers. | 85 // Allow the embedder to attach tab helpers. |
| 83 ios::GetChromeBrowserProvider()->AttachTabHelpers(web_state, tab); | 86 ios::GetChromeBrowserProvider()->AttachTabHelpers(web_state, tab); |
| 87 |
| 88 // Allow the Tab to attach tab helper like objects (all those objects should |
| 89 // really be tab helpers and created above). |
| 90 [tab attachTabHelpers]; |
| 84 } | 91 } |
| OLD | NEW |