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

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

Issue 2903173003: Removed -[CRWWebDelegate webWillReload] callback. (Closed)
Patch Set: Rebased Created 3 years, 6 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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 // not be null. 605 // not be null.
606 - (void)loadNativeViewWithSuccess:(BOOL)loadSuccess 606 - (void)loadNativeViewWithSuccess:(BOOL)loadSuccess
607 navigationContext:(web::NavigationContextImpl*)context; 607 navigationContext:(web::NavigationContextImpl*)context;
608 // Loads the correct HTML page for |error| in a native controller, retrieved 608 // Loads the correct HTML page for |error| in a native controller, retrieved
609 // from the native provider. 609 // from the native provider.
610 - (void)loadErrorInNativeView:(NSError*)error 610 - (void)loadErrorInNativeView:(NSError*)error
611 navigationContext:(web::NavigationContextImpl*)context; 611 navigationContext:(web::NavigationContextImpl*)context;
612 // YES if the navigation to |url| should be treated as a reload. 612 // YES if the navigation to |url| should be treated as a reload.
613 - (BOOL)shouldReload:(const GURL&)destinationURL 613 - (BOOL)shouldReload:(const GURL&)destinationURL
614 transition:(ui::PageTransition)transition; 614 transition:(ui::PageTransition)transition;
615 // Internal implementation of reload. Reloads without notifying the delegate.
616 // Most callers should use -reload instead.
617 - (void)reloadInternal;
618 // Aborts any load for both the web view and web controller. 615 // Aborts any load for both the web view and web controller.
619 - (void)abortLoad; 616 - (void)abortLoad;
620 // Updates the internal state and informs the delegate that any outstanding load 617 // Updates the internal state and informs the delegate that any outstanding load
621 // operations are cancelled. 618 // operations are cancelled.
622 - (void)loadCancelled; 619 - (void)loadCancelled;
623 // If YES, the page should be closed if it successfully redirects to a native 620 // If YES, the page should be closed if it successfully redirects to a native
624 // application, for example if a new tab redirects to the App Store. 621 // application, for example if a new tab redirects to the App Store.
625 - (BOOL)shouldClosePageOnNativeApplicationLoad; 622 - (BOOL)shouldClosePageOnNativeApplicationLoad;
626 // Called following navigation completion to generate final navigation lifecycle 623 // Called following navigation completion to generate final navigation lifecycle
627 // events. Navigation is considered complete when the document has finished 624 // events. Navigation is considered complete when the document has finished
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after
2017 2014
2018 - (BOOL)shouldReload:(const GURL&)destinationURL 2015 - (BOOL)shouldReload:(const GURL&)destinationURL
2019 transition:(ui::PageTransition)transition { 2016 transition:(ui::PageTransition)transition {
2020 // Do a reload if the user hits enter in the address bar or re-types a URL. 2017 // Do a reload if the user hits enter in the address bar or re-types a URL.
2021 web::NavigationItem* item = self.navigationManagerImpl->GetVisibleItem(); 2018 web::NavigationItem* item = self.navigationManagerImpl->GetVisibleItem();
2022 return (transition & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR) && item && 2019 return (transition & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR) && item &&
2023 (destinationURL == item->GetURL() || 2020 (destinationURL == item->GetURL() ||
2024 destinationURL == item->GetOriginalRequestURL()); 2021 destinationURL == item->GetOriginalRequestURL());
2025 } 2022 }
2026 2023
2027 // Reload either the web view or the native content depending on which is 2024 - (void)reload {
2028 // displayed.
2029 - (void)reloadInternal {
2030 // Clear last user interaction. 2025 // Clear last user interaction.
2031 // TODO(crbug.com/546337): Move to after the load commits, in the subclass 2026 // TODO(crbug.com/546337): Move to after the load commits, in the subclass
2032 // implementation. This will be inaccurate if the reload fails or is 2027 // implementation. This will be inaccurate if the reload fails or is
2033 // cancelled. 2028 // cancelled.
2034 _lastUserInteraction.reset(); 2029 _lastUserInteraction.reset();
2035 base::RecordAction(UserMetricsAction("Reload")); 2030 base::RecordAction(UserMetricsAction("Reload"));
2036 GURL url = self.currentNavItem->GetURL(); 2031 GURL url = self.currentNavItem->GetURL();
2037 if ([self shouldLoadURLInNativeView:url]) { 2032 if ([self shouldLoadURLInNativeView:url]) {
2038 std::unique_ptr<web::NavigationContextImpl> navigationContext = [self 2033 std::unique_ptr<web::NavigationContextImpl> navigationContext = [self
2039 registerLoadRequestForURL:url 2034 registerLoadRequestForURL:url
(...skipping 15 matching lines...) Expand all
2055 [transientItem->GetHttpRequestHeaders() copy]); 2050 [transientItem->GetHttpRequestHeaders() copy]);
2056 [self loadWithParams:reloadParams]; 2051 [self loadWithParams:reloadParams];
2057 } else { 2052 } else {
2058 self.currentNavItem->SetTransitionType( 2053 self.currentNavItem->SetTransitionType(
2059 ui::PageTransition::PAGE_TRANSITION_RELOAD); 2054 ui::PageTransition::PAGE_TRANSITION_RELOAD);
2060 [self loadCurrentURL]; 2055 [self loadCurrentURL];
2061 } 2056 }
2062 } 2057 }
2063 } 2058 }
2064 2059
2065 - (void)reload {
2066 [_delegate webWillReload];
2067 [self reloadInternal];
2068 }
2069
2070 - (void)abortLoad { 2060 - (void)abortLoad {
2071 [_webView stopLoading]; 2061 [_webView stopLoading];
2072 [_pendingNavigationInfo setCancelled:YES]; 2062 [_pendingNavigationInfo setCancelled:YES];
2073 _certVerificationErrors->Clear(); 2063 _certVerificationErrors->Clear();
2074 [self loadCancelled]; 2064 [self loadCancelled];
2075 } 2065 }
2076 2066
2077 - (void)loadCancelled { 2067 - (void)loadCancelled {
2078 [_passKitDownloader cancelPendingDownload]; 2068 [_passKitDownloader cancelPendingDownload];
2079 if (_loadPhase != web::PAGE_LOADED) { 2069 if (_loadPhase != web::PAGE_LOADED) {
(...skipping 3157 matching lines...) Expand 10 before | Expand all | Expand 10 after
5237 - (NSUInteger)observerCount { 5227 - (NSUInteger)observerCount {
5238 DCHECK_EQ(_observerBridges.size(), [_observers count]); 5228 DCHECK_EQ(_observerBridges.size(), [_observers count]);
5239 return [_observers count]; 5229 return [_observers count];
5240 } 5230 }
5241 5231
5242 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { 5232 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action {
5243 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; 5233 return [action.request valueForHTTPHeaderField:kReferrerHeaderName];
5244 } 5234 }
5245 5235
5246 @end 5236 @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