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

Side by Side Diff: ios/chrome/browser/tabs/tab.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.h ('k') | ios/chrome/browser/ui/browser_view_controller.mm » ('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/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 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 addLocationToNavigationItem:navigationItem 1109 addLocationToNavigationItem:navigationItem
1110 browserState:browserState_]; 1110 browserState:browserState_];
1111 } 1111 }
1112 1112
1113 - (void)loadSessionTab:(const sessions::SessionTab*)sessionTab { 1113 - (void)loadSessionTab:(const sessions::SessionTab*)sessionTab {
1114 DCHECK(sessionTab); 1114 DCHECK(sessionTab);
1115 [self replaceHistoryWithNavigations:sessionTab->navigations 1115 [self replaceHistoryWithNavigations:sessionTab->navigations
1116 currentIndex:sessionTab->current_navigation_index]; 1116 currentIndex:sessionTab->current_navigation_index];
1117 } 1117 }
1118 1118
1119 - (void)reload {
1120 // TODO(crbug.com/661671): Convert callers to go through CRWWebController
1121 // directly and remove this passthrough method.
1122 [self.webController reload];
1123 }
1124
1125 - (void)webWillReload { 1119 - (void)webWillReload {
1126 if ([parentTabModel_ tabUsageRecorder]) { 1120 if ([parentTabModel_ tabUsageRecorder]) {
1127 [parentTabModel_ tabUsageRecorder]->RecordReload(self); 1121 [parentTabModel_ tabUsageRecorder]->RecordReload(self);
1128 } 1122 }
1129 } 1123 }
1130 1124
1131 // Stop the page loading. 1125 // Stop the page loading.
1132 // Equivalent to the user pressing 'stop', or a window.stop() command. 1126 // Equivalent to the user pressing 'stop', or a window.stop() command.
1133 - (void)stopLoading { 1127 - (void)stopLoading {
1134 [self.webController stopLoading]; 1128 [self.webController stopLoading];
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 - (void)countMainFrameLoad { 1405 - (void)countMainFrameLoad {
1412 if ([self isPrerenderTab] || [self url].SchemeIs(kChromeUIScheme)) { 1406 if ([self isPrerenderTab] || [self url].SchemeIs(kChromeUIScheme)) {
1413 return; 1407 return;
1414 } 1408 }
1415 base::RecordAction(UserMetricsAction("MobilePageLoaded")); 1409 base::RecordAction(UserMetricsAction("MobilePageLoaded"));
1416 } 1410 }
1417 1411
1418 - (void)applicationDidBecomeActive { 1412 - (void)applicationDidBecomeActive {
1419 if (requireReloadAfterBecomingActive_) { 1413 if (requireReloadAfterBecomingActive_) {
1420 if (visible_) { 1414 if (visible_) {
1421 [self.webController reload]; 1415 self.navigationManager->Reload(web::ReloadType::NORMAL,
1416 false /* check_for_repost */);
1422 } else { 1417 } else {
1423 [self.webController requirePageReload]; 1418 [self.webController requirePageReload];
1424 } 1419 }
1425 requireReloadAfterBecomingActive_ = NO; 1420 requireReloadAfterBecomingActive_ = NO;
1426 } 1421 }
1427 } 1422 }
1428 1423
1429 #pragma mark - 1424 #pragma mark -
1430 #pragma mark FindInPageControllerDelegate 1425 #pragma mark FindInPageControllerDelegate
1431 1426
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 1941
1947 BOOL applicationIsBackgrounded = 1942 BOOL applicationIsBackgrounded =
1948 [UIApplication sharedApplication].applicationState == 1943 [UIApplication sharedApplication].applicationState ==
1949 UIApplicationStateBackground; 1944 UIApplicationStateBackground;
1950 if (visible_) { 1945 if (visible_) {
1951 if (!applicationIsBackgrounded) { 1946 if (!applicationIsBackgrounded) {
1952 base::WeakNSObject<Tab> weakSelf(self); 1947 base::WeakNSObject<Tab> weakSelf(self);
1953 base::scoped_nsobject<SadTabView> sadTabView( 1948 base::scoped_nsobject<SadTabView> sadTabView(
1954 [[SadTabView alloc] initWithReloadHandler:^{ 1949 [[SadTabView alloc] initWithReloadHandler:^{
1955 base::scoped_nsobject<Tab> strongSelf([weakSelf retain]); 1950 base::scoped_nsobject<Tab> strongSelf([weakSelf retain]);
1956 [strongSelf reload]; 1951
1952 // |check_for_repost| is true because this is called from SadTab and
1953 // explicitly initiated by the user.
1954 [strongSelf navigationManager]->Reload(web::ReloadType::NORMAL,
1955 true /* check_for_repost */);
1957 }]); 1956 }]);
1958 base::scoped_nsobject<CRWContentView> contentView( 1957 base::scoped_nsobject<CRWContentView> contentView(
1959 [[CRWGenericContentView alloc] initWithView:sadTabView]); 1958 [[CRWGenericContentView alloc] initWithView:sadTabView]);
1960 self.webState->ShowTransientContentView(contentView); 1959 self.webState->ShowTransientContentView(contentView);
1961 [fullScreenController_ disableFullScreen]; 1960 [fullScreenController_ disableFullScreen];
1962 } 1961 }
1963 } else { 1962 } else {
1964 [self.webController requirePageReload]; 1963 [self.webController requirePageReload];
1965 } 1964 }
1966 // Returning to the app (after the renderer crashed in the background) and 1965 // Returning to the app (after the renderer crashed in the background) and
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2100 2099
2101 - (TabModel*)parentTabModel { 2100 - (TabModel*)parentTabModel {
2102 return parentTabModel_; 2101 return parentTabModel_;
2103 } 2102 }
2104 2103
2105 - (FormInputAccessoryViewController*)inputAccessoryViewController { 2104 - (FormInputAccessoryViewController*)inputAccessoryViewController {
2106 return inputAccessoryViewController_.get(); 2105 return inputAccessoryViewController_.get();
2107 } 2106 }
2108 2107
2109 @end 2108 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/tabs/tab.h ('k') | ios/chrome/browser/ui/browser_view_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698