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

Side by Side Diff: ios/chrome/browser/tabs/tab.mm

Issue 2741413007: Refactoring Reload in NavigationManager and CRWWebController. (Closed)
Patch Set: tentative change 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/tabs/tab.h" 5 #import "ios/chrome/browser/tabs/tab.h"
6 6
7 #import <CoreLocation/CoreLocation.h> 7 #import <CoreLocation/CoreLocation.h>
8 #import <UIKit/UIKit.h> 8 #import <UIKit/UIKit.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 addLocationToNavigationItem:navigationItem 1158 addLocationToNavigationItem:navigationItem
1159 browserState:browserState_]; 1159 browserState:browserState_];
1160 } 1160 }
1161 1161
1162 - (void)loadSessionTab:(const sessions::SessionTab*)sessionTab { 1162 - (void)loadSessionTab:(const sessions::SessionTab*)sessionTab {
1163 DCHECK(sessionTab); 1163 DCHECK(sessionTab);
1164 [self replaceHistoryWithNavigations:sessionTab->navigations 1164 [self replaceHistoryWithNavigations:sessionTab->navigations
1165 currentIndex:sessionTab->current_navigation_index]; 1165 currentIndex:sessionTab->current_navigation_index];
1166 } 1166 }
1167 1167
1168 - (void)reload {
1169 // TODO(crbug.com/661671): Convert callers to go through CRWWebController
1170 // directly and remove this passthrough method.
1171 [self.webController reload];
1172 }
1173
1174 - (void)webWillReload { 1168 - (void)webWillReload {
1175 if ([parentTabModel_ tabUsageRecorder]) { 1169 if ([parentTabModel_ tabUsageRecorder]) {
1176 [parentTabModel_ tabUsageRecorder]->RecordReload(self); 1170 [parentTabModel_ tabUsageRecorder]->RecordReload(self);
1177 } 1171 }
1178 } 1172 }
1179 1173
1180 // Stop the page loading. 1174 // Stop the page loading.
1181 // Equivalent to the user pressing 'stop', or a window.stop() command. 1175 // Equivalent to the user pressing 'stop', or a window.stop() command.
1182 - (void)stopLoading { 1176 - (void)stopLoading {
1183 [self.webController stopLoading]; 1177 [self.webController stopLoading];
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 - (void)countMainFrameLoad { 1452 - (void)countMainFrameLoad {
1459 if ([self isPrerenderTab] || [self url].SchemeIs(kChromeUIScheme)) { 1453 if ([self isPrerenderTab] || [self url].SchemeIs(kChromeUIScheme)) {
1460 return; 1454 return;
1461 } 1455 }
1462 base::RecordAction(UserMetricsAction("MobilePageLoaded")); 1456 base::RecordAction(UserMetricsAction("MobilePageLoaded"));
1463 } 1457 }
1464 1458
1465 - (void)applicationDidBecomeActive { 1459 - (void)applicationDidBecomeActive {
1466 if (requireReloadAfterBecomingActive_) { 1460 if (requireReloadAfterBecomingActive_) {
1467 if (visible_) { 1461 if (visible_) {
1468 [self.webController reload]; 1462 self.navigationManager->Reload(web::ReloadType::NORMAL,
1463 false /* check_for_repost */);
1469 } else { 1464 } else {
1470 [self.webController requirePageReload]; 1465 [self.webController requirePageReload];
1471 } 1466 }
1472 requireReloadAfterBecomingActive_ = NO; 1467 requireReloadAfterBecomingActive_ = NO;
1473 } 1468 }
1474 } 1469 }
1475 1470
1476 #pragma mark - 1471 #pragma mark -
1477 #pragma mark FindInPageControllerDelegate 1472 #pragma mark FindInPageControllerDelegate
1478 1473
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1997 1992
1998 BOOL applicationIsBackgrounded = 1993 BOOL applicationIsBackgrounded =
1999 [UIApplication sharedApplication].applicationState == 1994 [UIApplication sharedApplication].applicationState ==
2000 UIApplicationStateBackground; 1995 UIApplicationStateBackground;
2001 if (visible_) { 1996 if (visible_) {
2002 if (!applicationIsBackgrounded) { 1997 if (!applicationIsBackgrounded) {
2003 base::WeakNSObject<Tab> weakSelf(self); 1998 base::WeakNSObject<Tab> weakSelf(self);
2004 base::scoped_nsobject<SadTabView> sadTabView( 1999 base::scoped_nsobject<SadTabView> sadTabView(
2005 [[SadTabView alloc] initWithReloadHandler:^{ 2000 [[SadTabView alloc] initWithReloadHandler:^{
2006 base::scoped_nsobject<Tab> strongSelf([weakSelf retain]); 2001 base::scoped_nsobject<Tab> strongSelf([weakSelf retain]);
2007 [strongSelf reload]; 2002 [strongSelf navigationManager]->Reload(
2003 web::ReloadType::NORMAL, false /* check_for_repost */);
Eugene But (OOO till 7-30) 2017/03/16 17:17:47 This is called from SadTab and explicitly initiate
liaoyuke 2017/03/16 18:10:42 Done.
2008 }]); 2004 }]);
2009 base::scoped_nsobject<CRWContentView> contentView( 2005 base::scoped_nsobject<CRWContentView> contentView(
2010 [[CRWGenericContentView alloc] initWithView:sadTabView]); 2006 [[CRWGenericContentView alloc] initWithView:sadTabView]);
2011 self.webState->ShowTransientContentView(contentView); 2007 self.webState->ShowTransientContentView(contentView);
2012 [fullScreenController_ disableFullScreen]; 2008 [fullScreenController_ disableFullScreen];
2013 } 2009 }
2014 } else { 2010 } else {
2015 [self.webController requirePageReload]; 2011 [self.webController requirePageReload];
2016 } 2012 }
2017 // Returning to the app (after the renderer crashed in the background) and 2013 // Returning to the app (after the renderer crashed in the background) and
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2151 2147
2152 - (TabModel*)parentTabModel { 2148 - (TabModel*)parentTabModel {
2153 return parentTabModel_; 2149 return parentTabModel_;
2154 } 2150 }
2155 2151
2156 - (FormInputAccessoryViewController*)inputAccessoryViewController { 2152 - (FormInputAccessoryViewController*)inputAccessoryViewController {
2157 return inputAccessoryViewController_.get(); 2153 return inputAccessoryViewController_.get();
2158 } 2154 }
2159 2155
2160 @end 2156 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698