| 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 |
| 11 #import "components/favicon/ios/web_favicon_driver.h" | 11 #import "components/favicon/ios/web_favicon_driver.h" |
| 12 #include "components/history/core/browser/top_sites.h" | 12 #include "components/history/core/browser/top_sites.h" |
| 13 #import "components/history/ios/browser/web_state_top_sites_observer.h" | 13 #import "components/history/ios/browser/web_state_top_sites_observer.h" |
| 14 #include "components/keyed_service/core/service_access_type.h" | 14 #include "components/keyed_service/core/service_access_type.h" |
| 15 #include "components/reading_list/core/reading_list_switches.h" | |
| 16 #import "components/signin/ios/browser/account_consistency_service.h" | 15 #import "components/signin/ios/browser/account_consistency_service.h" |
| 17 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" | 16 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" |
| 18 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 17 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 19 #include "ios/chrome/browser/favicon/favicon_service_factory.h" | 18 #include "ios/chrome/browser/favicon/favicon_service_factory.h" |
| 20 #import "ios/chrome/browser/find_in_page/find_tab_helper.h" | 19 #import "ios/chrome/browser/find_in_page/find_tab_helper.h" |
| 21 #include "ios/chrome/browser/history/history_service_factory.h" | 20 #include "ios/chrome/browser/history/history_service_factory.h" |
| 22 #include "ios/chrome/browser/history/top_sites_factory.h" | 21 #include "ios/chrome/browser/history/top_sites_factory.h" |
| 23 #import "ios/chrome/browser/infobars/infobar_manager_impl.h" | 22 #import "ios/chrome/browser/infobars/infobar_manager_impl.h" |
| 24 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" | 23 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" |
| 25 #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" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 49 | 48 |
| 50 NetworkActivityIndicatorTabHelper::CreateForWebState(web_state, tab.tabId); | 49 NetworkActivityIndicatorTabHelper::CreateForWebState(web_state, tab.tabId); |
| 51 IOSChromeSyncedTabDelegate::CreateForWebState(web_state); | 50 IOSChromeSyncedTabDelegate::CreateForWebState(web_state); |
| 52 InfoBarManagerImpl::CreateForWebState(web_state); | 51 InfoBarManagerImpl::CreateForWebState(web_state); |
| 53 IOSSecurityStateTabHelper::CreateForWebState(web_state); | 52 IOSSecurityStateTabHelper::CreateForWebState(web_state); |
| 54 RepostFormTabHelper::CreateForWebState(web_state); | 53 RepostFormTabHelper::CreateForWebState(web_state); |
| 55 BlockedPopupTabHelper::CreateForWebState(web_state); | 54 BlockedPopupTabHelper::CreateForWebState(web_state); |
| 56 FindTabHelper::CreateForWebState(web_state, tab.findInPageControllerDelegate); | 55 FindTabHelper::CreateForWebState(web_state, tab.findInPageControllerDelegate); |
| 57 StoreKitTabHelper::CreateForWebState(web_state); | 56 StoreKitTabHelper::CreateForWebState(web_state); |
| 58 | 57 |
| 59 if (reading_list::switches::IsReadingListEnabled()) { | 58 ReadingListModel* model = |
| 60 ReadingListModel* model = | 59 ReadingListModelFactory::GetForBrowserState(browser_state); |
| 61 ReadingListModelFactory::GetForBrowserState(browser_state); | 60 ReadingListWebStateObserver::FromWebState(web_state, model); |
| 62 ReadingListWebStateObserver::FromWebState(web_state, model); | |
| 63 } | |
| 64 | 61 |
| 65 if (AccountConsistencyService* account_consistency_service = | 62 if (AccountConsistencyService* account_consistency_service = |
| 66 ios::AccountConsistencyServiceFactory::GetForBrowserState( | 63 ios::AccountConsistencyServiceFactory::GetForBrowserState( |
| 67 browser_state)) { | 64 browser_state)) { |
| 68 account_consistency_service->SetWebStateHandler(web_state, tab); | 65 account_consistency_service->SetWebStateHandler(web_state, tab); |
| 69 } | 66 } |
| 70 ChromeIOSTranslateClient::CreateForWebState(web_state); | 67 ChromeIOSTranslateClient::CreateForWebState(web_state); |
| 71 | 68 |
| 72 ios::ChromeBrowserState* original_browser_state = | 69 ios::ChromeBrowserState* original_browser_state = |
| 73 browser_state->GetOriginalChromeBrowserState(); | 70 browser_state->GetOriginalChromeBrowserState(); |
| 74 favicon::WebFaviconDriver::CreateForWebState( | 71 favicon::WebFaviconDriver::CreateForWebState( |
| 75 web_state, | 72 web_state, |
| 76 ios::FaviconServiceFactory::GetForBrowserState( | 73 ios::FaviconServiceFactory::GetForBrowserState( |
| 77 original_browser_state, ServiceAccessType::IMPLICIT_ACCESS), | 74 original_browser_state, ServiceAccessType::IMPLICIT_ACCESS), |
| 78 ios::HistoryServiceFactory::GetForBrowserState( | 75 ios::HistoryServiceFactory::GetForBrowserState( |
| 79 original_browser_state, ServiceAccessType::IMPLICIT_ACCESS), | 76 original_browser_state, ServiceAccessType::IMPLICIT_ACCESS), |
| 80 ios::BookmarkModelFactory::GetForBrowserState(original_browser_state)); | 77 ios::BookmarkModelFactory::GetForBrowserState(original_browser_state)); |
| 81 history::WebStateTopSitesObserver::CreateForWebState( | 78 history::WebStateTopSitesObserver::CreateForWebState( |
| 82 web_state, | 79 web_state, |
| 83 ios::TopSitesFactory::GetForBrowserState(original_browser_state).get()); | 80 ios::TopSitesFactory::GetForBrowserState(original_browser_state).get()); |
| 84 | 81 |
| 85 // Allow the embedder to attach tab helpers. | 82 // Allow the embedder to attach tab helpers. |
| 86 ios::GetChromeBrowserProvider()->AttachTabHelpers(web_state, tab); | 83 ios::GetChromeBrowserProvider()->AttachTabHelpers(web_state, tab); |
| 87 } | 84 } |
| OLD | NEW |