Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2780403003: Removed -[CRWWebDelegate webWillInitiateLoadWithParams:]. (Closed)
Patch Set: Addressed review comment Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/web/public/web_state/ui/crw_web_delegate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 if ([nativeContent respondsToSelector:@selector(virtualURL)]) { 1784 if ([nativeContent respondsToSelector:@selector(virtualURL)]) {
1785 item->SetVirtualURL([nativeContent virtualURL]); 1785 item->SetVirtualURL([nativeContent virtualURL]);
1786 } 1786 }
1787 1787
1788 [self registerLoadRequest:targetURL 1788 [self registerLoadRequest:targetURL
1789 referrer:referrer 1789 referrer:referrer
1790 transition:self.currentTransition]; 1790 transition:self.currentTransition];
1791 [self loadNativeViewWithSuccess:YES]; 1791 [self loadNativeViewWithSuccess:YES];
1792 } 1792 }
1793 1793
1794 - (void)loadWithParams:(const NavigationManager::WebLoadParams&)originalParams { 1794 - (void)loadWithParams:(const NavigationManager::WebLoadParams&)params {
1795 // Make a copy of |params|, as some of the delegate methods may modify it. 1795 DCHECK(!(params.transition_type & ui::PAGE_TRANSITION_FORWARD_BACK));
1796 NavigationManager::WebLoadParams params(originalParams);
1797 1796
1798 // Initiating a navigation from the UI, record the current page state before
1799 // the new page loads.
1800
1801 [_delegate webWillInitiateLoadWithParams:params];
1802
1803 GURL navUrl = params.url;
1804 ui::PageTransition transition = params.transition_type;
1805 DCHECK(!(transition & ui::PAGE_TRANSITION_FORWARD_BACK));
1806
1807 BOOL initialNavigation = NO;
1808 // Clear transient view before making any changes to history and navigation 1797 // Clear transient view before making any changes to history and navigation
1809 // manager. TODO(stuartmorgan): Drive Transient Item clearing from 1798 // manager. TODO(stuartmorgan): Drive Transient Item clearing from
1810 // navigation system, rather than from WebController. 1799 // navigation system, rather than from WebController.
1811 [self clearTransientContentView]; 1800 [self clearTransientContentView];
1812 1801
1813 [self recordStateInHistory]; 1802 [self recordStateInHistory];
1814 1803
1815 if (!self.currentNavItem) 1804 BOOL initialNavigation = !self.currentNavItem;
1816 initialNavigation = YES;
1817 1805
1818 web::NavigationInitiationType navigationInitiationType = 1806 web::NavigationInitiationType navigationInitiationType =
1819 params.is_renderer_initiated 1807 params.is_renderer_initiated
1820 ? web::NavigationInitiationType::RENDERER_INITIATED 1808 ? web::NavigationInitiationType::RENDERER_INITIATED
1821 : web::NavigationInitiationType::USER_INITIATED; 1809 : web::NavigationInitiationType::USER_INITIATED;
1822 self.navigationManagerImpl->AddPendingItem( 1810 self.navigationManagerImpl->AddPendingItem(
1823 navUrl, params.referrer, transition, navigationInitiationType, 1811 params.url, params.referrer, params.transition_type,
1824 params.user_agent_override_option); 1812 navigationInitiationType, params.user_agent_override_option);
1825 1813
1826 web::NavigationItemImpl* addedItem = self.currentNavItem; 1814 web::NavigationItemImpl* addedItem = self.currentNavItem;
1827 DCHECK(addedItem); 1815 DCHECK(addedItem);
1828 if (params.extra_headers) 1816 if (params.extra_headers)
1829 addedItem->AddHttpRequestHeaders(params.extra_headers); 1817 addedItem->AddHttpRequestHeaders(params.extra_headers);
1830 if (params.post_data) { 1818 if (params.post_data) {
1831 DCHECK([addedItem->GetHttpRequestHeaders() objectForKey:@"Content-Type"]) 1819 DCHECK([addedItem->GetHttpRequestHeaders() objectForKey:@"Content-Type"])
1832 << "Post data should have an associated content type"; 1820 << "Post data should have an associated content type";
1833 addedItem->SetPostData(params.post_data); 1821 addedItem->SetPostData(params.post_data);
1834 addedItem->SetShouldSkipRepostFormConfirmation(true); 1822 addedItem->SetShouldSkipRepostFormConfirmation(true);
(...skipping 3246 matching lines...) Expand 10 before | Expand all | Expand 10 after
5081 - (void)simulateLoadRequestWithURL:(const GURL&)URL { 5069 - (void)simulateLoadRequestWithURL:(const GURL&)URL {
5082 _lastRegisteredRequestURL = URL; 5070 _lastRegisteredRequestURL = URL;
5083 _loadPhase = web::LOAD_REQUESTED; 5071 _loadPhase = web::LOAD_REQUESTED;
5084 } 5072 }
5085 5073
5086 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { 5074 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action {
5087 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; 5075 return [action.request valueForHTTPHeaderField:kReferrerHeaderName];
5088 } 5076 }
5089 5077
5090 @end 5078 @end
OLDNEW
« no previous file with comments | « ios/web/public/web_state/ui/crw_web_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698