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

Side by Side Diff: ios/chrome/browser/ui/browser_view_controller.mm

Issue 2741413007: Refactoring Reload in NavigationManager and CRWWebController. (Closed)
Patch Set: Rebase and Remove DCHECK in |loadWithParams| as it has already been taken care of Created 3 years, 9 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/chrome/browser/tabs/tab.mm ('k') | ios/web/navigation/navigation_manager_delegate.h » ('j') | 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/chrome/browser/ui/browser_view_controller.h" 5 #import "ios/chrome/browser/ui/browser_view_controller.h"
6 6
7 #import <AssetsLibrary/AssetsLibrary.h> 7 #import <AssetsLibrary/AssetsLibrary.h>
8 #import <MobileCoreServices/MobileCoreServices.h> 8 #import <MobileCoreServices/MobileCoreServices.h>
9 #import <PassKit/PassKit.h> 9 #import <PassKit/PassKit.h>
10 #import <Photos/Photos.h> 10 #import <Photos/Photos.h>
(...skipping 2866 matching lines...) Expand 10 before | Expand all | Expand 10 after
2877 2877
2878 - (void)overscrollActionsController:(OverscrollActionsController*)controller 2878 - (void)overscrollActionsController:(OverscrollActionsController*)controller
2879 didTriggerAction:(OverscrollAction)action { 2879 didTriggerAction:(OverscrollAction)action {
2880 switch (action) { 2880 switch (action) {
2881 case OverscrollAction::NEW_TAB: 2881 case OverscrollAction::NEW_TAB:
2882 [self newTab:nil]; 2882 [self newTab:nil];
2883 break; 2883 break;
2884 case OverscrollAction::CLOSE_TAB: 2884 case OverscrollAction::CLOSE_TAB:
2885 [self closeCurrentTab]; 2885 [self closeCurrentTab];
2886 break; 2886 break;
2887 case OverscrollAction::REFRESH: 2887 case OverscrollAction::REFRESH: {
2888 if ([[[_model currentTab] webController] loadPhase] == 2888 if ([[[_model currentTab] webController] loadPhase] ==
2889 web::PAGE_LOADING) { 2889 web::PAGE_LOADING) {
2890 [[_model currentTab] stopLoading]; 2890 [[_model currentTab] stopLoading];
2891 } 2891 }
2892 [[_model currentTab] reload]; 2892
2893 web::WebState* webState = [_model currentTab].webState;
2894 if (webState)
2895 // |check_for_repost| is true because the reload is explicitly initiated
2896 // by the user.
2897 webState->GetNavigationManager()->Reload(web::ReloadType::NORMAL,
2898 true /* check_for_repost */);
2893 break; 2899 break;
2900 }
2894 case OverscrollAction::NONE: 2901 case OverscrollAction::NONE:
2895 NOTREACHED(); 2902 NOTREACHED();
2896 break; 2903 break;
2897 } 2904 }
2898 } 2905 }
2899 2906
2900 - (BOOL)shouldAllowOverscrollActions { 2907 - (BOOL)shouldAllowOverscrollActions {
2901 return YES; 2908 return YES;
2902 } 2909 }
2903 2910
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
3831 return; 3838 return;
3832 [_typingShield setHidden:YES]; 3839 [_typingShield setHidden:YES];
3833 }]; 3840 }];
3834 [[OmniboxGeolocationController sharedInstance] 3841 [[OmniboxGeolocationController sharedInstance]
3835 locationBarDidResignFirstResponder:_browserState]; 3842 locationBarDidResignFirstResponder:_browserState];
3836 3843
3837 // If a load was cancelled by an omnibox edit, but nothing is loading when 3844 // If a load was cancelled by an omnibox edit, but nothing is loading when
3838 // editing ends (i.e., editing was cancelled), restart the cancelled load. 3845 // editing ends (i.e., editing was cancelled), restart the cancelled load.
3839 if (_locationBarEditCancelledLoad) { 3846 if (_locationBarEditCancelledLoad) {
3840 _locationBarEditCancelledLoad = NO; 3847 _locationBarEditCancelledLoad = NO;
3841 if (!_toolbarModelIOS->IsLoading()) { 3848
3842 [[_model currentTab] reload]; 3849 web::WebState* webState = [_model currentTab].webState;
3843 } 3850 if (!_toolbarModelIOS->IsLoading() && webState)
3851 webState->GetNavigationManager()->Reload(web::ReloadType::NORMAL,
3852 false /* check_for_repost */);
3844 } 3853 }
3845 } 3854 }
3846 3855
3847 - (IBAction)locationBarBeganEdit:(id)sender { 3856 - (IBAction)locationBarBeganEdit:(id)sender {
3848 // On handsets, if a page is currently loading it should be stopped. 3857 // On handsets, if a page is currently loading it should be stopped.
3849 if (!IsIPadIdiom() && _toolbarModelIOS->IsLoading()) { 3858 if (!IsIPadIdiom() && _toolbarModelIOS->IsLoading()) {
3850 base::scoped_nsobject<GenericChromeCommand> command( 3859 base::scoped_nsobject<GenericChromeCommand> command(
3851 [[GenericChromeCommand alloc] initWithTag:IDC_STOP]); 3860 [[GenericChromeCommand alloc] initWithTag:IDC_STOP]);
3852 [self chromeExecuteCommand:command]; 3861 [self chromeExecuteCommand:command];
3853 _locationBarEditCancelledLoad = YES; 3862 _locationBarEditCancelledLoad = YES;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
3974 _voiceSearchController->PrepareToAppear(); 3983 _voiceSearchController->PrepareToAppear();
3975 break; 3984 break;
3976 case IDC_NEW_INCOGNITO_TAB: 3985 case IDC_NEW_INCOGNITO_TAB:
3977 if (_isOffTheRecord) { 3986 if (_isOffTheRecord) {
3978 [self newTab:sender]; 3987 [self newTab:sender];
3979 } else { 3988 } else {
3980 // Not for this browser state, send it on its way. 3989 // Not for this browser state, send it on its way.
3981 [super chromeExecuteCommand:sender]; 3990 [super chromeExecuteCommand:sender];
3982 } 3991 }
3983 break; 3992 break;
3984 case IDC_RELOAD: 3993 case IDC_RELOAD: {
3985 [[_model currentTab] reload]; 3994 web::WebState* webState = [_model currentTab].webState;
3995 if (webState)
3996 // |check_for_repost| is true because the reload is explicitly initiated
3997 // by the user.
3998 webState->GetNavigationManager()->Reload(web::ReloadType::NORMAL,
3999 true /* check_for_repost */);
3986 break; 4000 break;
4001 }
3987 case IDC_SHARE_PAGE: 4002 case IDC_SHARE_PAGE:
3988 [self sharePage]; 4003 [self sharePage];
3989 break; 4004 break;
3990 case IDC_SHOW_MAIL_COMPOSER: 4005 case IDC_SHOW_MAIL_COMPOSER:
3991 [self showMailComposer:sender]; 4006 [self showMailComposer:sender];
3992 break; 4007 break;
3993 case IDC_READER_MODE: 4008 case IDC_READER_MODE:
3994 [[_model currentTab] switchToReaderMode]; 4009 [[_model currentTab] switchToReaderMode];
3995 break; 4010 break;
3996 case IDC_REQUEST_DESKTOP_SITE: 4011 case IDC_REQUEST_DESKTOP_SITE:
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
5110 5125
5111 - (UIView*)voiceSearchButton { 5126 - (UIView*)voiceSearchButton {
5112 return _voiceSearchButton; 5127 return _voiceSearchButton;
5113 } 5128 }
5114 5129
5115 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { 5130 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner {
5116 return [self currentLogoAnimationControllerOwner]; 5131 return [self currentLogoAnimationControllerOwner];
5117 } 5132 }
5118 5133
5119 @end 5134 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/tabs/tab.mm ('k') | ios/web/navigation/navigation_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698