| 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/web/web_state/ui/crw_web_controller.h" | 5 #import "ios/web/web_state/ui/crw_web_controller.h" |
| 6 | 6 |
| 7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
| 8 | 8 |
| 9 #import <objc/runtime.h> | 9 #import <objc/runtime.h> |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 BOOL _isHalted; // YES if halted. Halting happens prior to destruction. | 318 BOOL _isHalted; // YES if halted. Halting happens prior to destruction. |
| 319 BOOL _isBeingDestroyed; // YES if in the process of closing. | 319 BOOL _isBeingDestroyed; // YES if in the process of closing. |
| 320 // All CRWWebControllerObservers attached to the CRWWebController. A | 320 // All CRWWebControllerObservers attached to the CRWWebController. A |
| 321 // specially-constructed set is used that does not retain its elements. | 321 // specially-constructed set is used that does not retain its elements. |
| 322 base::scoped_nsobject<NSMutableSet> _observers; | 322 base::scoped_nsobject<NSMutableSet> _observers; |
| 323 // Each observer in |_observers| is associated with a | 323 // Each observer in |_observers| is associated with a |
| 324 // WebControllerObserverBridge in order to listen from WebState callbacks. | 324 // WebControllerObserverBridge in order to listen from WebState callbacks. |
| 325 // TODO(droger): Remove |_observerBridges| when all CRWWebControllerObservers | 325 // TODO(droger): Remove |_observerBridges| when all CRWWebControllerObservers |
| 326 // are converted to WebStateObservers. | 326 // are converted to WebStateObservers. |
| 327 ScopedVector<web::WebControllerObserverBridge> _observerBridges; | 327 ScopedVector<web::WebControllerObserverBridge> _observerBridges; |
| 328 // |windowId| that is saved when a page changes. Used to detect refreshes. | |
| 329 base::scoped_nsobject<NSString> _lastSeenWindowID; | |
| 330 // YES if a user interaction has been registered at any time once the page has | 328 // YES if a user interaction has been registered at any time once the page has |
| 331 // loaded. | 329 // loaded. |
| 332 BOOL _userInteractionRegistered; | 330 BOOL _userInteractionRegistered; |
| 333 // YES if the user has interacted with the content area since the last URL | 331 // YES if the user has interacted with the content area since the last URL |
| 334 // change. | 332 // change. |
| 335 BOOL _interactionRegisteredSinceLastURLChange; | 333 BOOL _interactionRegisteredSinceLastURLChange; |
| 336 // The actual URL of the document object (i.e., the last committed URL). | 334 // The actual URL of the document object (i.e., the last committed URL). |
| 337 // TODO(crbug.com/549616): Remove this in favor of just updating the | 335 // TODO(crbug.com/549616): Remove this in favor of just updating the |
| 338 // navigation manager and treating that as authoritative. | 336 // navigation manager and treating that as authoritative. |
| 339 GURL _documentURL; | 337 GURL _documentURL; |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 _webStateImpl->InitializeRequestTracker(self); | 1031 _webStateImpl->InitializeRequestTracker(self); |
| 1034 // Load phase when no WebView present is 'loaded' because this represents | 1032 // Load phase when no WebView present is 'loaded' because this represents |
| 1035 // the idle state. | 1033 // the idle state. |
| 1036 _loadPhase = web::PAGE_LOADED; | 1034 _loadPhase = web::PAGE_LOADED; |
| 1037 // Content area is lazily instantiated. | 1035 // Content area is lazily instantiated. |
| 1038 _defaultURL = GURL(url::kAboutBlankURL); | 1036 _defaultURL = GURL(url::kAboutBlankURL); |
| 1039 _jsInjectionReceiver.reset( | 1037 _jsInjectionReceiver.reset( |
| 1040 [[CRWJSInjectionReceiver alloc] initWithEvaluator:self]); | 1038 [[CRWJSInjectionReceiver alloc] initWithEvaluator:self]); |
| 1041 _windowIDJSManager.reset([(CRWJSWindowIdManager*)[_jsInjectionReceiver | 1039 _windowIDJSManager.reset([(CRWJSWindowIdManager*)[_jsInjectionReceiver |
| 1042 instanceOfClass:[CRWJSWindowIdManager class]] retain]); | 1040 instanceOfClass:[CRWJSWindowIdManager class]] retain]); |
| 1043 _lastSeenWindowID.reset(); | |
| 1044 _webViewProxy.reset( | 1041 _webViewProxy.reset( |
| 1045 [[CRWWebViewProxyImpl alloc] initWithWebController:self]); | 1042 [[CRWWebViewProxyImpl alloc] initWithWebController:self]); |
| 1046 [[_webViewProxy scrollViewProxy] addObserver:self]; | 1043 [[_webViewProxy scrollViewProxy] addObserver:self]; |
| 1047 _gestureRecognizers.reset([[NSMutableArray alloc] init]); | 1044 _gestureRecognizers.reset([[NSMutableArray alloc] init]); |
| 1048 _webViewToolbars.reset([[NSMutableArray alloc] init]); | 1045 _webViewToolbars.reset([[NSMutableArray alloc] init]); |
| 1049 _pendingLoadCompleteActions.reset([[NSMutableArray alloc] init]); | 1046 _pendingLoadCompleteActions.reset([[NSMutableArray alloc] init]); |
| 1050 web::BrowserState* browserState = _webStateImpl->GetBrowserState(); | 1047 web::BrowserState* browserState = _webStateImpl->GetBrowserState(); |
| 1051 _certVerificationController.reset([[CRWCertVerificationController alloc] | 1048 _certVerificationController.reset([[CRWCertVerificationController alloc] |
| 1052 initWithBrowserState:browserState]); | 1049 initWithBrowserState:browserState]); |
| 1053 _certVerificationErrors.reset( | 1050 _certVerificationErrors.reset( |
| (...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3197 // TODO(stuartmorgan): This shouldn't be called for hash state or | 3194 // TODO(stuartmorgan): This shouldn't be called for hash state or |
| 3198 // push/replaceState. | 3195 // push/replaceState. |
| 3199 [self resetDocumentSpecificState]; | 3196 [self resetDocumentSpecificState]; |
| 3200 | 3197 |
| 3201 [self didStartLoadingURL:currentURL updateHistory:YES]; | 3198 [self didStartLoadingURL:currentURL updateHistory:YES]; |
| 3202 } | 3199 } |
| 3203 | 3200 |
| 3204 - (void)resetDocumentSpecificState { | 3201 - (void)resetDocumentSpecificState { |
| 3205 _lastUserInteraction.reset(); | 3202 _lastUserInteraction.reset(); |
| 3206 _clickInProgress = NO; | 3203 _clickInProgress = NO; |
| 3207 _lastSeenWindowID.reset([[_windowIDJSManager windowId] copy]); | |
| 3208 } | 3204 } |
| 3209 | 3205 |
| 3210 - (void)didStartLoadingURL:(const GURL&)url updateHistory:(BOOL)updateHistory { | 3206 - (void)didStartLoadingURL:(const GURL&)url updateHistory:(BOOL)updateHistory { |
| 3211 _loadPhase = web::PAGE_LOADING; | 3207 _loadPhase = web::PAGE_LOADING; |
| 3212 _URLOnStartLoading = url; | 3208 _URLOnStartLoading = url; |
| 3213 _displayStateOnStartLoading = self.pageDisplayState; | 3209 _displayStateOnStartLoading = self.pageDisplayState; |
| 3214 | 3210 |
| 3215 self.userInteractionRegistered = NO; | 3211 self.userInteractionRegistered = NO; |
| 3216 _pageHasZoomed = NO; | 3212 _pageHasZoomed = NO; |
| 3217 | 3213 |
| (...skipping 2432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5650 } | 5646 } |
| 5651 | 5647 |
| 5652 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 5648 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
| 5653 } | 5649 } |
| 5654 | 5650 |
| 5655 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { | 5651 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { |
| 5656 return [action.request valueForHTTPHeaderField:@"Referer"]; | 5652 return [action.request valueForHTTPHeaderField:@"Referer"]; |
| 5657 } | 5653 } |
| 5658 | 5654 |
| 5659 @end | 5655 @end |
| OLD | NEW |