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 2844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2855 // navigations. | 2855 // navigations. |
2856 if (_dispatchingSameDocumentHashChangeEvent) { | 2856 if (_dispatchingSameDocumentHashChangeEvent) { |
2857 _dispatchingSameDocumentHashChangeEvent = NO; | 2857 _dispatchingSameDocumentHashChangeEvent = NO; |
2858 } else { | 2858 } else { |
2859 web::NavigationItemImpl* item = | 2859 web::NavigationItemImpl* item = |
2860 static_cast<web::NavigationItemImpl*>([self currentNavItem]); | 2860 static_cast<web::NavigationItemImpl*>([self currentNavItem]); |
2861 DCHECK(item); | 2861 DCHECK(item); |
2862 item->SetIsCreatedFromHashChange(true); | 2862 item->SetIsCreatedFromHashChange(true); |
2863 } | 2863 } |
2864 | 2864 |
2865 // Notify the observers. | |
2866 _webStateImpl->OnUrlHashChanged(); | |
2867 return YES; | 2865 return YES; |
2868 } | 2866 } |
2869 | 2867 |
2870 - (BOOL)handleWindowHistoryBackMessage:(base::DictionaryValue*)message | 2868 - (BOOL)handleWindowHistoryBackMessage:(base::DictionaryValue*)message |
2871 context:(NSDictionary*)context { | 2869 context:(NSDictionary*)context { |
2872 [self goDelta:-1]; | 2870 [self goDelta:-1]; |
2873 return YES; | 2871 return YES; |
2874 } | 2872 } |
2875 | 2873 |
2876 - (BOOL)handleWindowHistoryForwardMessage:(base::DictionaryValue*)message | 2874 - (BOOL)handleWindowHistoryForwardMessage:(base::DictionaryValue*)message |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2955 transition:transition]; | 2953 transition:transition]; |
2956 | 2954 |
2957 NSString* replaceWebViewJS = | 2955 NSString* replaceWebViewJS = |
2958 [self javaScriptToReplaceWebViewURL:pushURL stateObjectJSON:stateObject]; | 2956 [self javaScriptToReplaceWebViewURL:pushURL stateObjectJSON:stateObject]; |
2959 base::WeakNSObject<CRWWebController> weakSelf(self); | 2957 base::WeakNSObject<CRWWebController> weakSelf(self); |
2960 [self executeJavaScript:replaceWebViewJS completionHandler:^(id, NSError*) { | 2958 [self executeJavaScript:replaceWebViewJS completionHandler:^(id, NSError*) { |
2961 if (!weakSelf || weakSelf.get()->_isBeingDestroyed) | 2959 if (!weakSelf || weakSelf.get()->_isBeingDestroyed) |
2962 return; | 2960 return; |
2963 base::scoped_nsobject<CRWWebController> strongSelf([weakSelf retain]); | 2961 base::scoped_nsobject<CRWWebController> strongSelf([weakSelf retain]); |
2964 [strongSelf optOutScrollsToTopForSubviews]; | 2962 [strongSelf optOutScrollsToTopForSubviews]; |
2965 // Notify the observers. | |
2966 strongSelf.get()->_webStateImpl->OnHistoryStateChanged(); | |
2967 [strongSelf didFinishNavigation]; | 2963 [strongSelf didFinishNavigation]; |
2968 }]; | 2964 }]; |
2969 return YES; | 2965 return YES; |
2970 } | 2966 } |
2971 | 2967 |
2972 - (BOOL)handleWindowHistoryDidReplaceStateMessage: | 2968 - (BOOL)handleWindowHistoryDidReplaceStateMessage: |
2973 (base::DictionaryValue*)message | 2969 (base::DictionaryValue*)message |
2974 context:(NSDictionary*)context { | 2970 context:(NSDictionary*)context { |
2975 DCHECK(_changingHistoryState); | 2971 DCHECK(_changingHistoryState); |
2976 _changingHistoryState = NO; | 2972 _changingHistoryState = NO; |
(...skipping 2271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5248 - (void)simulateLoadRequestWithURL:(const GURL&)URL { | 5244 - (void)simulateLoadRequestWithURL:(const GURL&)URL { |
5249 _lastRegisteredRequestURL = URL; | 5245 _lastRegisteredRequestURL = URL; |
5250 _loadPhase = web::LOAD_REQUESTED; | 5246 _loadPhase = web::LOAD_REQUESTED; |
5251 } | 5247 } |
5252 | 5248 |
5253 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { | 5249 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { |
5254 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; | 5250 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; |
5255 } | 5251 } |
5256 | 5252 |
5257 @end | 5253 @end |
OLD | NEW |