OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 |
| 2003 // |check_for_repost| is true because this is called from SadTab and |
| 2004 // explicitly initiated by the user. |
| 2005 check_for_repost should be true[strongSelf navigationManager] |
| 2006 ->Reload(web::ReloadType::NORMAL, true /* check_for_repost */); |
2008 }]); | 2007 }]); |
2009 base::scoped_nsobject<CRWContentView> contentView( | 2008 base::scoped_nsobject<CRWContentView> contentView( |
2010 [[CRWGenericContentView alloc] initWithView:sadTabView]); | 2009 [[CRWGenericContentView alloc] initWithView:sadTabView]); |
2011 self.webState->ShowTransientContentView(contentView); | 2010 self.webState->ShowTransientContentView(contentView); |
2012 [fullScreenController_ disableFullScreen]; | 2011 [fullScreenController_ disableFullScreen]; |
2013 } | 2012 } |
2014 } else { | 2013 } else { |
2015 [self.webController requirePageReload]; | 2014 [self.webController requirePageReload]; |
2016 } | 2015 } |
2017 // Returning to the app (after the renderer crashed in the background) and | 2016 // Returning to the app (after the renderer crashed in the background) and |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2151 | 2150 |
2152 - (TabModel*)parentTabModel { | 2151 - (TabModel*)parentTabModel { |
2153 return parentTabModel_; | 2152 return parentTabModel_; |
2154 } | 2153 } |
2155 | 2154 |
2156 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2155 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
2157 return inputAccessoryViewController_.get(); | 2156 return inputAccessoryViewController_.get(); |
2158 } | 2157 } |
2159 | 2158 |
2160 @end | 2159 @end |
OLD | NEW |