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

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

Issue 2741413007: Refactoring Reload in NavigationManager and CRWWebController. (Closed)
Patch Set: Addressed high level comments 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
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 2867 matching lines...) Expand 10 before | Expand all | Expand 10 after
2878 2878
2879 - (void)overscrollActionsController:(OverscrollActionsController*)controller 2879 - (void)overscrollActionsController:(OverscrollActionsController*)controller
2880 didTriggerAction:(OverscrollAction)action { 2880 didTriggerAction:(OverscrollAction)action {
2881 switch (action) { 2881 switch (action) {
2882 case OverscrollAction::NEW_TAB: 2882 case OverscrollAction::NEW_TAB:
2883 [self newTab:nil]; 2883 [self newTab:nil];
2884 break; 2884 break;
2885 case OverscrollAction::CLOSE_TAB: 2885 case OverscrollAction::CLOSE_TAB:
2886 [self closeCurrentTab]; 2886 [self closeCurrentTab];
2887 break; 2887 break;
2888 case OverscrollAction::REFRESH: 2888 case OverscrollAction::REFRESH: {
2889 if ([[[_model currentTab] webController] loadPhase] == 2889 if ([[[_model currentTab] webController] loadPhase] ==
2890 web::PAGE_LOADING) { 2890 web::PAGE_LOADING) {
2891 [[_model currentTab] stopLoading]; 2891 [[_model currentTab] stopLoading];
2892 } 2892 }
2893 [[_model currentTab] reload]; 2893
2894 web::WebState* webState = [_model currentTab].webState;
2895 if (webState)
2896 webState->GetNavigationManager()->Reload(web::ReloadType::NORMAL,
2897 true /* check_for_repost */);
2894 break; 2898 break;
2899 }
2895 case OverscrollAction::NONE: 2900 case OverscrollAction::NONE:
2896 NOTREACHED(); 2901 NOTREACHED();
2897 break; 2902 break;
2898 } 2903 }
2899 } 2904 }
2900 2905
2901 - (BOOL)shouldAllowOverscrollActions { 2906 - (BOOL)shouldAllowOverscrollActions {
2902 return YES; 2907 return YES;
2903 } 2908 }
2904 2909
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
3835 return; 3840 return;
3836 [_typingShield setHidden:YES]; 3841 [_typingShield setHidden:YES];
3837 }]; 3842 }];
3838 [[OmniboxGeolocationController sharedInstance] 3843 [[OmniboxGeolocationController sharedInstance]
3839 locationBarDidResignFirstResponder:_browserState]; 3844 locationBarDidResignFirstResponder:_browserState];
3840 3845
3841 // If a load was cancelled by an omnibox edit, but nothing is loading when 3846 // If a load was cancelled by an omnibox edit, but nothing is loading when
3842 // editing ends (i.e., editing was cancelled), restart the cancelled load. 3847 // editing ends (i.e., editing was cancelled), restart the cancelled load.
3843 if (_locationBarEditCancelledLoad) { 3848 if (_locationBarEditCancelledLoad) {
3844 _locationBarEditCancelledLoad = NO; 3849 _locationBarEditCancelledLoad = NO;
3845 if (!_toolbarModelIOS->IsLoading()) { 3850
3846 [[_model currentTab] reload]; 3851 web::WebState* webState = [_model currentTab].webState;
3847 } 3852 if (!_toolbarModelIOS->IsLoading() && webState)
3853 webState->GetNavigationManager()->Reload(web::ReloadType::NORMAL,
3854 true /* check_for_repost */);
3848 } 3855 }
3849 } 3856 }
3850 3857
3851 - (IBAction)locationBarBeganEdit:(id)sender { 3858 - (IBAction)locationBarBeganEdit:(id)sender {
3852 // On handsets, if a page is currently loading it should be stopped. 3859 // On handsets, if a page is currently loading it should be stopped.
3853 if (!IsIPadIdiom() && _toolbarModelIOS->IsLoading()) { 3860 if (!IsIPadIdiom() && _toolbarModelIOS->IsLoading()) {
3854 base::scoped_nsobject<GenericChromeCommand> command( 3861 base::scoped_nsobject<GenericChromeCommand> command(
3855 [[GenericChromeCommand alloc] initWithTag:IDC_STOP]); 3862 [[GenericChromeCommand alloc] initWithTag:IDC_STOP]);
3856 [self chromeExecuteCommand:command]; 3863 [self chromeExecuteCommand:command];
3857 _locationBarEditCancelledLoad = YES; 3864 _locationBarEditCancelledLoad = YES;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
3979 _voiceSearchController->PrepareToAppear(); 3986 _voiceSearchController->PrepareToAppear();
3980 break; 3987 break;
3981 case IDC_NEW_INCOGNITO_TAB: 3988 case IDC_NEW_INCOGNITO_TAB:
3982 if (_isOffTheRecord) { 3989 if (_isOffTheRecord) {
3983 [self newTab:sender]; 3990 [self newTab:sender];
3984 } else { 3991 } else {
3985 // Not for this browser state, send it on its way. 3992 // Not for this browser state, send it on its way.
3986 [super chromeExecuteCommand:sender]; 3993 [super chromeExecuteCommand:sender];
3987 } 3994 }
3988 break; 3995 break;
3989 case IDC_RELOAD: 3996 case IDC_RELOAD: {
3990 [[_model currentTab] reload]; 3997 web::WebState* webState = [_model currentTab].webState;
3998 if (webState)
3999 webState->GetNavigationManager()->Reload(web::ReloadType::NORMAL,
4000 true /* check_for_repost */);
3991 break; 4001 break;
4002 }
3992 case IDC_SHARE_PAGE: 4003 case IDC_SHARE_PAGE:
3993 [self sharePage]; 4004 [self sharePage];
3994 break; 4005 break;
3995 case IDC_SHOW_MAIL_COMPOSER: 4006 case IDC_SHOW_MAIL_COMPOSER:
3996 [self showMailComposer:sender]; 4007 [self showMailComposer:sender];
3997 break; 4008 break;
3998 case IDC_READER_MODE: 4009 case IDC_READER_MODE:
3999 [[_model currentTab] switchToReaderMode]; 4010 [[_model currentTab] switchToReaderMode];
4000 break; 4011 break;
4001 case IDC_REQUEST_DESKTOP_SITE: 4012 case IDC_REQUEST_DESKTOP_SITE:
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
5101 5112
5102 - (UIView*)voiceSearchButton { 5113 - (UIView*)voiceSearchButton {
5103 return _voiceSearchButton; 5114 return _voiceSearchButton;
5104 } 5115 }
5105 5116
5106 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { 5117 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner {
5107 return [self currentLogoAnimationControllerOwner]; 5118 return [self currentLogoAnimationControllerOwner];
5108 } 5119 }
5109 5120
5110 @end 5121 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698