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 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1855 BOOL initialNavigation = !self.currentNavItem; | 1855 BOOL initialNavigation = !self.currentNavItem; |
1856 | 1856 |
1857 web::NavigationInitiationType navigationInitiationType = | 1857 web::NavigationInitiationType navigationInitiationType = |
1858 params.is_renderer_initiated | 1858 params.is_renderer_initiated |
1859 ? web::NavigationInitiationType::RENDERER_INITIATED | 1859 ? web::NavigationInitiationType::RENDERER_INITIATED |
1860 : web::NavigationInitiationType::USER_INITIATED; | 1860 : web::NavigationInitiationType::USER_INITIATED; |
1861 self.navigationManagerImpl->AddPendingItem( | 1861 self.navigationManagerImpl->AddPendingItem( |
1862 params.url, params.referrer, params.transition_type, | 1862 params.url, params.referrer, params.transition_type, |
1863 navigationInitiationType, params.user_agent_override_option); | 1863 navigationInitiationType, params.user_agent_override_option); |
1864 | 1864 |
| 1865 // Mark pending item as created from hash change if necessary. This is needed |
| 1866 // because window.hashchange message may not arrive on time. |
| 1867 web::NavigationItemImpl* pendingItem = self.sessionController.pendingItem; |
| 1868 if (pendingItem) { |
| 1869 GURL lastCommittedURL = _webStateImpl->GetLastCommittedURL(); |
| 1870 GURL pendingURL = pendingItem->GetURL(); |
| 1871 if (lastCommittedURL != pendingURL && |
| 1872 lastCommittedURL.EqualsIgnoringRef(pendingURL)) { |
| 1873 pendingItem->SetIsCreatedFromHashChange(true); |
| 1874 } |
| 1875 } |
| 1876 |
1865 web::NavigationItemImpl* addedItem = self.currentNavItem; | 1877 web::NavigationItemImpl* addedItem = self.currentNavItem; |
1866 DCHECK(addedItem); | 1878 DCHECK(addedItem); |
1867 if (params.extra_headers) | 1879 if (params.extra_headers) |
1868 addedItem->AddHttpRequestHeaders(params.extra_headers); | 1880 addedItem->AddHttpRequestHeaders(params.extra_headers); |
1869 if (params.post_data) { | 1881 if (params.post_data) { |
1870 DCHECK([addedItem->GetHttpRequestHeaders() objectForKey:@"Content-Type"]) | 1882 DCHECK([addedItem->GetHttpRequestHeaders() objectForKey:@"Content-Type"]) |
1871 << "Post data should have an associated content type"; | 1883 << "Post data should have an associated content type"; |
1872 addedItem->SetPostData(params.post_data); | 1884 addedItem->SetPostData(params.post_data); |
1873 addedItem->SetShouldSkipRepostFormConfirmation(true); | 1885 addedItem->SetShouldSkipRepostFormConfirmation(true); |
1874 } | 1886 } |
(...skipping 3345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5220 - (NSUInteger)observerCount { | 5232 - (NSUInteger)observerCount { |
5221 DCHECK_EQ(_observerBridges.size(), [_observers count]); | 5233 DCHECK_EQ(_observerBridges.size(), [_observers count]); |
5222 return [_observers count]; | 5234 return [_observers count]; |
5223 } | 5235 } |
5224 | 5236 |
5225 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { | 5237 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { |
5226 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; | 5238 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; |
5227 } | 5239 } |
5228 | 5240 |
5229 @end | 5241 @end |
OLD | NEW |