| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 inputAccessoryViewController_; | 267 inputAccessoryViewController_; |
| 267 | 268 |
| 268 // TODO(crbug.com/661665): move the WebContentsObservers into their own | 269 // TODO(crbug.com/661665): move the WebContentsObservers into their own |
| 269 // container. | 270 // container. |
| 270 // Handles saving and autofill of passwords. | 271 // Handles saving and autofill of passwords. |
| 271 base::scoped_nsobject<PasswordController> passwordController_; | 272 base::scoped_nsobject<PasswordController> passwordController_; |
| 272 | 273 |
| 273 // Handles autofill. | 274 // Handles autofill. |
| 274 base::scoped_nsobject<AutofillController> autofillController_; | 275 base::scoped_nsobject<AutofillController> autofillController_; |
| 275 | 276 |
| 276 // Handles find on page. | |
| 277 base::scoped_nsobject<FindInPageController> findInPageController_; | |
| 278 | |
| 279 // Handles GAL infobar on web pages. | 277 // Handles GAL infobar on web pages. |
| 280 base::scoped_nsobject<NativeAppNavigationController> | 278 base::scoped_nsobject<NativeAppNavigationController> |
| 281 nativeAppNavigationController_; | 279 nativeAppNavigationController_; |
| 282 | 280 |
| 283 // Handles caching and retrieving of snapshots. | 281 // Handles caching and retrieving of snapshots. |
| 284 base::scoped_nsobject<SnapshotManager> snapshotManager_; | 282 base::scoped_nsobject<SnapshotManager> snapshotManager_; |
| 285 | 283 |
| 286 // Handles retrieving, generating and updating snapshots of CRWWebController's | 284 // Handles retrieving, generating and updating snapshots of CRWWebController's |
| 287 // web page. | 285 // web page. |
| 288 base::scoped_nsobject<WebControllerSnapshotHelper> | 286 base::scoped_nsobject<WebControllerSnapshotHelper> |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 [self.webController setDelegate:self]; | 536 [self.webController setDelegate:self]; |
| 539 | 537 |
| 540 NSString* sessionID = self.tabId; | 538 NSString* sessionID = self.tabId; |
| 541 DCHECK(sessionID); | 539 DCHECK(sessionID); |
| 542 snapshotManager_.reset([[SnapshotManager alloc] init]); | 540 snapshotManager_.reset([[SnapshotManager alloc] init]); |
| 543 | 541 |
| 544 webControllerSnapshotHelper_.reset([[WebControllerSnapshotHelper alloc] | 542 webControllerSnapshotHelper_.reset([[WebControllerSnapshotHelper alloc] |
| 545 initWithSnapshotManager:snapshotManager_ | 543 initWithSnapshotManager:snapshotManager_ |
| 546 tab:self]); | 544 tab:self]); |
| 547 | 545 |
| 548 findInPageController_.reset([[FindInPageController alloc] | |
| 549 initWithWebState:self.webState | |
| 550 delegate:self]); | |
| 551 | |
| 552 [self initNativeAppNavigationController]; | 546 [self initNativeAppNavigationController]; |
| 553 | 547 |
| 554 if (attachTabHelpers) { | 548 if (attachTabHelpers) { |
| 555 // IOSChromeSessionTabHelper comes first because it sets up the tab ID, | 549 // IOSChromeSessionTabHelper comes first because it sets up the tab ID, |
| 556 // and other helpers may rely on that. | 550 // and other helpers may rely on that. |
| 557 IOSChromeSessionTabHelper::CreateForWebState(self.webState); | 551 IOSChromeSessionTabHelper::CreateForWebState(self.webState); |
| 558 | 552 |
| 559 NetworkActivityIndicatorTabHelper::CreateForWebState(self.webState, | 553 NetworkActivityIndicatorTabHelper::CreateForWebState(self.webState, |
| 560 self.tabId); | 554 self.tabId); |
| 561 IOSChromeSyncedTabDelegate::CreateForWebState(self.webState); | 555 IOSChromeSyncedTabDelegate::CreateForWebState(self.webState); |
| 562 InfoBarManagerImpl::CreateForWebState(self.webState); | 556 InfoBarManagerImpl::CreateForWebState(self.webState); |
| 563 IOSSecurityStateTabHelper::CreateForWebState(self.webState); | 557 IOSSecurityStateTabHelper::CreateForWebState(self.webState); |
| 564 RepostFormTabHelper::CreateForWebState(self.webState); | 558 RepostFormTabHelper::CreateForWebState(self.webState); |
| 565 BlockedPopupTabHelper::CreateForWebState(self.webState); | 559 BlockedPopupTabHelper::CreateForWebState(self.webState); |
| 560 FindTabHelper::CreateForWebState(self.webState, self); |
| 566 | 561 |
| 567 if (reading_list::switches::IsReadingListEnabled()) { | 562 if (reading_list::switches::IsReadingListEnabled()) { |
| 568 ReadingListModel* model = | 563 ReadingListModel* model = |
| 569 ReadingListModelFactory::GetForBrowserState(browserState_); | 564 ReadingListModelFactory::GetForBrowserState(browserState_); |
| 570 ReadingListWebStateObserver::FromWebState(self.webState, model); | 565 ReadingListWebStateObserver::FromWebState(self.webState, model); |
| 571 } | 566 } |
| 572 | 567 |
| 573 tabInfoBarObserver_.reset(new TabInfoBarObserver(self)); | 568 tabInfoBarObserver_.reset(new TabInfoBarObserver(self)); |
| 574 tabInfoBarObserver_->SetShouldObserveInfoBarManager(true); | 569 tabInfoBarObserver_->SetShouldObserveInfoBarManager(true); |
| 575 | 570 |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 // random time. | 1182 // random time. |
| 1188 - (void)close { | 1183 - (void)close { |
| 1189 self.fullScreenControllerDelegate = nil; | 1184 self.fullScreenControllerDelegate = nil; |
| 1190 self.overscrollActionsControllerDelegate = nil; | 1185 self.overscrollActionsControllerDelegate = nil; |
| 1191 self.passKitDialogProvider = nil; | 1186 self.passKitDialogProvider = nil; |
| 1192 self.snapshotOverlayProvider = nil; | 1187 self.snapshotOverlayProvider = nil; |
| 1193 self.storeKitLauncher = nil; | 1188 self.storeKitLauncher = nil; |
| 1194 | 1189 |
| 1195 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 1190 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 1196 | 1191 |
| 1197 [findInPageController_ detachFromWebState]; | |
| 1198 findInPageController_.reset(); | |
| 1199 | |
| 1200 [passwordController_ detach]; | 1192 [passwordController_ detach]; |
| 1201 passwordController_.reset(); | 1193 passwordController_.reset(); |
| 1202 tabInfoBarObserver_.reset(); | 1194 tabInfoBarObserver_.reset(); |
| 1203 | 1195 |
| 1204 faviconDriverObserverBridge_.reset(); | 1196 faviconDriverObserverBridge_.reset(); |
| 1205 [openInController_ detachFromWebController]; | 1197 [openInController_ detachFromWebController]; |
| 1206 openInController_.reset(); | 1198 openInController_.reset(); |
| 1207 [autofillController_ detachFromWebState]; | 1199 [autofillController_ detachFromWebState]; |
| 1208 [suggestionController_ detachFromWebState]; | 1200 [suggestionController_ detachFromWebState]; |
| 1209 if (fullScreenController_) | 1201 if (fullScreenController_) |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1691 [parentTabModel_ notifyTabChanged:self]; | 1683 [parentTabModel_ notifyTabChanged:self]; |
| 1692 } | 1684 } |
| 1693 | 1685 |
| 1694 - (void)webState:(web::WebState*)webState | 1686 - (void)webState:(web::WebState*)webState |
| 1695 didCommitNavigationWithDetails:(const web::LoadCommittedDetails&)details { | 1687 didCommitNavigationWithDetails:(const web::LoadCommittedDetails&)details { |
| 1696 DCHECK([self navigationManager]); | 1688 DCHECK([self navigationManager]); |
| 1697 // |webWillAddPendingURL:transition:| is not called for native page loads. | 1689 // |webWillAddPendingURL:transition:| is not called for native page loads. |
| 1698 // TODO(crbug.com/381201): Move this call there once that bug is fixed so that | 1690 // TODO(crbug.com/381201): Move this call there once that bug is fixed so that |
| 1699 // |disableFullScreen| is called only from one place. | 1691 // |disableFullScreen| is called only from one place. |
| 1700 [fullScreenController_ disableFullScreen]; | 1692 [fullScreenController_ disableFullScreen]; |
| 1701 [findInPageController_ disableFindInPageWithCompletionHandler:nil]; | |
| 1702 GURL lastCommittedURL = webState->GetLastCommittedURL(); | 1693 GURL lastCommittedURL = webState->GetLastCommittedURL(); |
| 1703 [autoReloadBridge_ loadStartedForURL:lastCommittedURL]; | 1694 [autoReloadBridge_ loadStartedForURL:lastCommittedURL]; |
| 1704 | 1695 |
| 1705 if (isUserNavigationEvent_) { | 1696 if (isUserNavigationEvent_) { |
| 1706 [[NSNotificationCenter defaultCenter] | 1697 [[NSNotificationCenter defaultCenter] |
| 1707 postNotificationName:kTabModelUserNavigatedNotification | 1698 postNotificationName:kTabModelUserNavigatedNotification |
| 1708 object:self]; | 1699 object:self]; |
| 1709 } | 1700 } |
| 1710 if (parentTabModel_) { | 1701 if (parentTabModel_) { |
| 1711 [[NSNotificationCenter defaultCenter] | 1702 [[NSNotificationCenter defaultCenter] |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2168 inBackground:NO | 2159 inBackground:NO |
| 2169 appendTo:kLastTab]); | 2160 appendTo:kLastTab]); |
| 2170 [self.view chromeExecuteCommand:command]; | 2161 [self.view chromeExecuteCommand:command]; |
| 2171 } else { | 2162 } else { |
| 2172 base::scoped_nsobject<GenericChromeCommand> chromeCommand( | 2163 base::scoped_nsobject<GenericChromeCommand> chromeCommand( |
| 2173 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_INCOGNITO_TAB]); | 2164 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_INCOGNITO_TAB]); |
| 2174 [self.view chromeExecuteCommand:chromeCommand]; | 2165 [self.view chromeExecuteCommand:chromeCommand]; |
| 2175 } | 2166 } |
| 2176 } | 2167 } |
| 2177 | 2168 |
| 2178 - (FindInPageController*)findInPageController { | |
| 2179 return findInPageController_; | |
| 2180 } | |
| 2181 | |
| 2182 - (NativeAppNavigationController*)nativeAppNavigationController { | 2169 - (NativeAppNavigationController*)nativeAppNavigationController { |
| 2183 return nativeAppNavigationController_; | 2170 return nativeAppNavigationController_; |
| 2184 } | 2171 } |
| 2185 | 2172 |
| 2186 - (void)initNativeAppNavigationController { | 2173 - (void)initNativeAppNavigationController { |
| 2187 if (browserState_->IsOffTheRecord()) | 2174 if (browserState_->IsOffTheRecord()) |
| 2188 return; | 2175 return; |
| 2189 DCHECK(!nativeAppNavigationController_); | 2176 DCHECK(!nativeAppNavigationController_); |
| 2190 nativeAppNavigationController_.reset([[NativeAppNavigationController alloc] | 2177 nativeAppNavigationController_.reset([[NativeAppNavigationController alloc] |
| 2191 initWithWebState:self.webState | 2178 initWithWebState:self.webState |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2239 | 2226 |
| 2240 - (TabModel*)parentTabModel { | 2227 - (TabModel*)parentTabModel { |
| 2241 return parentTabModel_; | 2228 return parentTabModel_; |
| 2242 } | 2229 } |
| 2243 | 2230 |
| 2244 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2231 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2245 return inputAccessoryViewController_.get(); | 2232 return inputAccessoryViewController_.get(); |
| 2246 } | 2233 } |
| 2247 | 2234 |
| 2248 @end | 2235 @end |
| OLD | NEW |