| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.h" | 5 #import "ios/chrome/browser/tabs/tab.h" |
| 6 | 6 |
| 7 #import <CoreLocation/CoreLocation.h> | 7 #import <CoreLocation/CoreLocation.h> |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #import "ios/chrome/browser/autofill/form_input_accessory_view_controller.h" | 56 #import "ios/chrome/browser/autofill/form_input_accessory_view_controller.h" |
| 57 #import "ios/chrome/browser/autofill/form_suggestion_controller.h" | 57 #import "ios/chrome/browser/autofill/form_suggestion_controller.h" |
| 58 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" | 58 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" |
| 59 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 59 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 60 #include "ios/chrome/browser/chrome_url_constants.h" | 60 #include "ios/chrome/browser/chrome_url_constants.h" |
| 61 #include "ios/chrome/browser/content_settings/host_content_settings_map_factory.
h" | 61 #include "ios/chrome/browser/content_settings/host_content_settings_map_factory.
h" |
| 62 #import "ios/chrome/browser/crash_loop_detection_util.h" | 62 #import "ios/chrome/browser/crash_loop_detection_util.h" |
| 63 #include "ios/chrome/browser/experimental_flags.h" | 63 #include "ios/chrome/browser/experimental_flags.h" |
| 64 #include "ios/chrome/browser/favicon/favicon_service_factory.h" | 64 #include "ios/chrome/browser/favicon/favicon_service_factory.h" |
| 65 #import "ios/chrome/browser/find_in_page/find_in_page_controller.h" | 65 #import "ios/chrome/browser/find_in_page/find_in_page_controller.h" |
| 66 #import "ios/chrome/browser/find_in_page/find_tab_helper.h" |
| 66 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller.h" | 67 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller.h" |
| 67 #include "ios/chrome/browser/history/history_service_factory.h" | 68 #include "ios/chrome/browser/history/history_service_factory.h" |
| 68 #include "ios/chrome/browser/history/top_sites_factory.h" | 69 #include "ios/chrome/browser/history/top_sites_factory.h" |
| 69 #include "ios/chrome/browser/infobars/infobar_manager_impl.h" | 70 #include "ios/chrome/browser/infobars/infobar_manager_impl.h" |
| 70 #include "ios/chrome/browser/metrics/ios_chrome_origins_seen_service_factory.h" | 71 #include "ios/chrome/browser/metrics/ios_chrome_origins_seen_service_factory.h" |
| 71 #import "ios/chrome/browser/metrics/tab_usage_recorder.h" | 72 #import "ios/chrome/browser/metrics/tab_usage_recorder.h" |
| 72 #import "ios/chrome/browser/native_app_launcher/native_app_navigation_controller
.h" | 73 #import "ios/chrome/browser/native_app_launcher/native_app_navigation_controller
.h" |
| 73 #import "ios/chrome/browser/passwords/password_controller.h" | 74 #import "ios/chrome/browser/passwords/password_controller.h" |
| 74 #import "ios/chrome/browser/passwords/passwords_ui_delegate_impl.h" | 75 #import "ios/chrome/browser/passwords/passwords_ui_delegate_impl.h" |
| 75 #include "ios/chrome/browser/pref_names.h" | 76 #include "ios/chrome/browser/pref_names.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 inputAccessoryViewController_; | 268 inputAccessoryViewController_; |
| 268 | 269 |
| 269 // TODO(crbug.com/661665): move the WebContentsObservers into their own | 270 // TODO(crbug.com/661665): move the WebContentsObservers into their own |
| 270 // container. | 271 // container. |
| 271 // Handles saving and autofill of passwords. | 272 // Handles saving and autofill of passwords. |
| 272 base::scoped_nsobject<PasswordController> passwordController_; | 273 base::scoped_nsobject<PasswordController> passwordController_; |
| 273 | 274 |
| 274 // Handles autofill. | 275 // Handles autofill. |
| 275 base::scoped_nsobject<AutofillController> autofillController_; | 276 base::scoped_nsobject<AutofillController> autofillController_; |
| 276 | 277 |
| 277 // Handles find on page. | |
| 278 base::scoped_nsobject<FindInPageController> findInPageController_; | |
| 279 | |
| 280 // Handles GAL infobar on web pages. | 278 // Handles GAL infobar on web pages. |
| 281 base::scoped_nsobject<NativeAppNavigationController> | 279 base::scoped_nsobject<NativeAppNavigationController> |
| 282 nativeAppNavigationController_; | 280 nativeAppNavigationController_; |
| 283 | 281 |
| 284 // Handles caching and retrieving of snapshots. | 282 // Handles caching and retrieving of snapshots. |
| 285 base::scoped_nsobject<SnapshotManager> snapshotManager_; | 283 base::scoped_nsobject<SnapshotManager> snapshotManager_; |
| 286 | 284 |
| 287 // Handles retrieving, generating and updating snapshots of CRWWebController's | 285 // Handles retrieving, generating and updating snapshots of CRWWebController's |
| 288 // web page. | 286 // web page. |
| 289 base::scoped_nsobject<WebControllerSnapshotHelper> | 287 base::scoped_nsobject<WebControllerSnapshotHelper> |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 [self.webController setDelegate:self]; | 541 [self.webController setDelegate:self]; |
| 544 | 542 |
| 545 NSString* sessionID = self.tabId; | 543 NSString* sessionID = self.tabId; |
| 546 DCHECK(sessionID); | 544 DCHECK(sessionID); |
| 547 snapshotManager_.reset([[SnapshotManager alloc] init]); | 545 snapshotManager_.reset([[SnapshotManager alloc] init]); |
| 548 | 546 |
| 549 webControllerSnapshotHelper_.reset([[WebControllerSnapshotHelper alloc] | 547 webControllerSnapshotHelper_.reset([[WebControllerSnapshotHelper alloc] |
| 550 initWithSnapshotManager:snapshotManager_ | 548 initWithSnapshotManager:snapshotManager_ |
| 551 tab:self]); | 549 tab:self]); |
| 552 | 550 |
| 553 findInPageController_.reset([[FindInPageController alloc] | |
| 554 initWithWebState:self.webState | |
| 555 delegate:self]); | |
| 556 | |
| 557 [self initNativeAppNavigationController]; | 551 [self initNativeAppNavigationController]; |
| 558 | 552 |
| 559 if (attachTabHelpers) { | 553 if (attachTabHelpers) { |
| 560 // IOSChromeSessionTabHelper comes first because it sets up the tab ID, | 554 // IOSChromeSessionTabHelper comes first because it sets up the tab ID, |
| 561 // and other helpers may rely on that. | 555 // and other helpers may rely on that. |
| 562 IOSChromeSessionTabHelper::CreateForWebState(self.webState); | 556 IOSChromeSessionTabHelper::CreateForWebState(self.webState); |
| 563 | 557 |
| 564 NetworkActivityIndicatorTabHelper::CreateForWebState(self.webState, | 558 NetworkActivityIndicatorTabHelper::CreateForWebState(self.webState, |
| 565 self.tabId); | 559 self.tabId); |
| 566 IOSChromeSyncedTabDelegate::CreateForWebState(self.webState); | 560 IOSChromeSyncedTabDelegate::CreateForWebState(self.webState); |
| 567 InfoBarManagerImpl::CreateForWebState(self.webState); | 561 InfoBarManagerImpl::CreateForWebState(self.webState); |
| 568 IOSSecurityStateTabHelper::CreateForWebState(self.webState); | 562 IOSSecurityStateTabHelper::CreateForWebState(self.webState); |
| 569 RepostFormTabHelper::CreateForWebState(self.webState); | 563 RepostFormTabHelper::CreateForWebState(self.webState); |
| 570 BlockedPopupTabHelper::CreateForWebState(self.webState); | 564 BlockedPopupTabHelper::CreateForWebState(self.webState); |
| 565 FindTabHelper::CreateForWebState(self.webState, self); |
| 571 | 566 |
| 572 if (reading_list::switches::IsReadingListEnabled()) { | 567 if (reading_list::switches::IsReadingListEnabled()) { |
| 573 ReadingListModel* model = | 568 ReadingListModel* model = |
| 574 ReadingListModelFactory::GetForBrowserState(browserState_); | 569 ReadingListModelFactory::GetForBrowserState(browserState_); |
| 575 ReadingListWebStateObserver::FromWebState(self.webState, model); | 570 ReadingListWebStateObserver::FromWebState(self.webState, model); |
| 576 } | 571 } |
| 577 | 572 |
| 578 tabInfoBarObserver_.reset(new TabInfoBarObserver(self)); | 573 tabInfoBarObserver_.reset(new TabInfoBarObserver(self)); |
| 579 tabInfoBarObserver_->SetShouldObserveInfoBarManager(true); | 574 tabInfoBarObserver_->SetShouldObserveInfoBarManager(true); |
| 580 | 575 |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 // random time. | 1187 // random time. |
| 1193 - (void)close { | 1188 - (void)close { |
| 1194 self.fullScreenControllerDelegate = nil; | 1189 self.fullScreenControllerDelegate = nil; |
| 1195 self.overscrollActionsControllerDelegate = nil; | 1190 self.overscrollActionsControllerDelegate = nil; |
| 1196 self.passKitDialogProvider = nil; | 1191 self.passKitDialogProvider = nil; |
| 1197 self.snapshotOverlayProvider = nil; | 1192 self.snapshotOverlayProvider = nil; |
| 1198 self.storeKitLauncher = nil; | 1193 self.storeKitLauncher = nil; |
| 1199 | 1194 |
| 1200 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 1195 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 1201 | 1196 |
| 1202 [findInPageController_ detachFromWebState]; | |
| 1203 findInPageController_.reset(); | |
| 1204 | |
| 1205 [passwordController_ detach]; | 1197 [passwordController_ detach]; |
| 1206 passwordController_.reset(); | 1198 passwordController_.reset(); |
| 1207 tabInfoBarObserver_.reset(); | 1199 tabInfoBarObserver_.reset(); |
| 1208 | 1200 |
| 1209 faviconDriverObserverBridge_.reset(); | 1201 faviconDriverObserverBridge_.reset(); |
| 1210 [openInController_ detachFromWebController]; | 1202 [openInController_ detachFromWebController]; |
| 1211 openInController_.reset(); | 1203 openInController_.reset(); |
| 1212 [autofillController_ detachFromWebState]; | 1204 [autofillController_ detachFromWebState]; |
| 1213 [suggestionController_ detachFromWebState]; | 1205 [suggestionController_ detachFromWebState]; |
| 1214 if (fullScreenController_) | 1206 if (fullScreenController_) |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1698 [parentTabModel_ notifyTabChanged:self]; | 1690 [parentTabModel_ notifyTabChanged:self]; |
| 1699 } | 1691 } |
| 1700 | 1692 |
| 1701 - (void)webState:(web::WebState*)webState | 1693 - (void)webState:(web::WebState*)webState |
| 1702 didCommitNavigationWithDetails:(const web::LoadCommittedDetails&)details { | 1694 didCommitNavigationWithDetails:(const web::LoadCommittedDetails&)details { |
| 1703 DCHECK([self navigationManager]); | 1695 DCHECK([self navigationManager]); |
| 1704 // |webWillAddPendingURL:transition:| is not called for native page loads. | 1696 // |webWillAddPendingURL:transition:| is not called for native page loads. |
| 1705 // TODO(crbug.com/381201): Move this call there once that bug is fixed so that | 1697 // TODO(crbug.com/381201): Move this call there once that bug is fixed so that |
| 1706 // |disableFullScreen| is called only from one place. | 1698 // |disableFullScreen| is called only from one place. |
| 1707 [fullScreenController_ disableFullScreen]; | 1699 [fullScreenController_ disableFullScreen]; |
| 1708 [findInPageController_ disableFindInPageWithCompletionHandler:nil]; | |
| 1709 GURL lastCommittedURL = webState->GetLastCommittedURL(); | 1700 GURL lastCommittedURL = webState->GetLastCommittedURL(); |
| 1710 [autoReloadBridge_ loadStartedForURL:lastCommittedURL]; | 1701 [autoReloadBridge_ loadStartedForURL:lastCommittedURL]; |
| 1711 | 1702 |
| 1712 if (isUserNavigationEvent_) { | 1703 if (isUserNavigationEvent_) { |
| 1713 [[NSNotificationCenter defaultCenter] | 1704 [[NSNotificationCenter defaultCenter] |
| 1714 postNotificationName:kTabModelUserNavigatedNotification | 1705 postNotificationName:kTabModelUserNavigatedNotification |
| 1715 object:self]; | 1706 object:self]; |
| 1716 } | 1707 } |
| 1717 if (parentTabModel_) { | 1708 if (parentTabModel_) { |
| 1718 [[NSNotificationCenter defaultCenter] | 1709 [[NSNotificationCenter defaultCenter] |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2175 inBackground:NO | 2166 inBackground:NO |
| 2176 appendTo:kLastTab]); | 2167 appendTo:kLastTab]); |
| 2177 [self.view chromeExecuteCommand:command]; | 2168 [self.view chromeExecuteCommand:command]; |
| 2178 } else { | 2169 } else { |
| 2179 base::scoped_nsobject<GenericChromeCommand> chromeCommand( | 2170 base::scoped_nsobject<GenericChromeCommand> chromeCommand( |
| 2180 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_INCOGNITO_TAB]); | 2171 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_INCOGNITO_TAB]); |
| 2181 [self.view chromeExecuteCommand:chromeCommand]; | 2172 [self.view chromeExecuteCommand:chromeCommand]; |
| 2182 } | 2173 } |
| 2183 } | 2174 } |
| 2184 | 2175 |
| 2185 - (FindInPageController*)findInPageController { | |
| 2186 return findInPageController_; | |
| 2187 } | |
| 2188 | |
| 2189 - (NativeAppNavigationController*)nativeAppNavigationController { | 2176 - (NativeAppNavigationController*)nativeAppNavigationController { |
| 2190 return nativeAppNavigationController_; | 2177 return nativeAppNavigationController_; |
| 2191 } | 2178 } |
| 2192 | 2179 |
| 2193 - (void)initNativeAppNavigationController { | 2180 - (void)initNativeAppNavigationController { |
| 2194 if (browserState_->IsOffTheRecord()) | 2181 if (browserState_->IsOffTheRecord()) |
| 2195 return; | 2182 return; |
| 2196 DCHECK(!nativeAppNavigationController_); | 2183 DCHECK(!nativeAppNavigationController_); |
| 2197 nativeAppNavigationController_.reset([[NativeAppNavigationController alloc] | 2184 nativeAppNavigationController_.reset([[NativeAppNavigationController alloc] |
| 2198 initWithWebState:self.webState | 2185 initWithWebState:self.webState |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2246 | 2233 |
| 2247 - (TabModel*)parentTabModel { | 2234 - (TabModel*)parentTabModel { |
| 2248 return parentTabModel_; | 2235 return parentTabModel_; |
| 2249 } | 2236 } |
| 2250 | 2237 |
| 2251 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2238 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2252 return inputAccessoryViewController_.get(); | 2239 return inputAccessoryViewController_.get(); |
| 2253 } | 2240 } |
| 2254 | 2241 |
| 2255 @end | 2242 @end |
| OLD | NEW |