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

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

Issue 2969273002: Cleaned up webWillAddPendingURL:transition: callback. (Closed)
Patch Set: Created 3 years, 5 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 | « no previous file | no next file » | 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 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 // destination URL is included in the |url| parameter. 1332 // destination URL is included in the |url| parameter.
1333 // Warning: because of the present design it is possible for malicious websites 1333 // Warning: because of the present design it is possible for malicious websites
1334 // to invoke superflous instances of this delegate with artibrary URLs. 1334 // to invoke superflous instances of this delegate with artibrary URLs.
1335 // Ensure there is nothing here that could be a risk to the user beyond mild 1335 // Ensure there is nothing here that could be a risk to the user beyond mild
1336 // confusion in that event (e.g. progress bar starting unexpectedly). 1336 // confusion in that event (e.g. progress bar starting unexpectedly).
1337 - (void)webWillAddPendingURL:(const GURL&)url 1337 - (void)webWillAddPendingURL:(const GURL&)url
1338 transition:(ui::PageTransition)transition { 1338 transition:(ui::PageTransition)transition {
1339 DCHECK(self.webController.loadPhase == web::LOAD_REQUESTED); 1339 DCHECK(self.webController.loadPhase == web::LOAD_REQUESTED);
1340 DCHECK([self navigationManager]); 1340 DCHECK([self navigationManager]);
1341 1341
1342 // Move the toolbar to visible during page load.
1343 [_fullScreenController disableFullScreen];
1344
1345 BOOL isUserNavigationEvent = 1342 BOOL isUserNavigationEvent =
1346 (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) == 0; 1343 (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) == 0;
1347 // Check for link-follow clobbers. These are changes where there is no 1344 // Check for link-follow clobbers. These are changes where there is no
1348 // pending entry (since that means the change wasn't caused by this class), 1345 // pending entry (since that means the change wasn't caused by this class),
1349 // and where the URL changes (to avoid counting page resurrection). 1346 // and where the URL changes (to avoid counting page resurrection).
1350 // TODO(crbug.com/546401): Consider moving this into NavigationManager, or 1347 // TODO(crbug.com/546401): Consider moving this into NavigationManager, or
1351 // into a NavigationManager observer callback, so it doesn't need to be 1348 // into a NavigationManager observer callback, so it doesn't need to be
1352 // checked in several places. 1349 // checked in several places.
1353 if (isUserNavigationEvent && !_isPrerenderTab && 1350 if (isUserNavigationEvent && !_isPrerenderTab &&
1354 ![self navigationManager]->GetPendingItem() && 1351 ![self navigationManager]->GetPendingItem() &&
1355 url != self.lastCommittedURL) { 1352 url != self.lastCommittedURL) {
1356 base::RecordAction(base::UserMetricsAction("MobileTabClobbered")); 1353 base::RecordAction(base::UserMetricsAction("MobileTabClobbered"));
1357 if ([_parentTabModel tabUsageRecorder]) 1354 if ([_parentTabModel tabUsageRecorder])
1358 [_parentTabModel tabUsageRecorder]->RecordPageLoadStart(self); 1355 [_parentTabModel tabUsageRecorder]->RecordPageLoadStart(self);
1359 } 1356 }
1360 if (![self navigationManager]->GetPendingItem()) { 1357 if (![self navigationManager]->GetPendingItem()) {
1361 // Reset |isVoiceSearchResultsTab| since a new page is being navigated to. 1358 // Reset |isVoiceSearchResultsTab| since a new page is being navigated to.
1362 self.isVoiceSearchResultsTab = NO; 1359 self.isVoiceSearchResultsTab = NO;
1363 } 1360 }
1364 } 1361 }
1365 1362
1366 - (void)webState:(web::WebState*)webState 1363 - (void)webState:(web::WebState*)webState
1367 didStartNavigation:(web::NavigationContext*)navigation { 1364 didStartNavigation:(web::NavigationContext*)navigation {
1368 if ([_parentTabModel tabUsageRecorder] && 1365 if ([_parentTabModel tabUsageRecorder] &&
1369 PageTransitionCoreTypeIs(navigation->GetPageTransition(), 1366 PageTransitionCoreTypeIs(navigation->GetPageTransition(),
1370 ui::PAGE_TRANSITION_RELOAD)) { 1367 ui::PAGE_TRANSITION_RELOAD)) {
1371 [_parentTabModel tabUsageRecorder]->RecordReload(self); 1368 [_parentTabModel tabUsageRecorder]->RecordReload(self);
1372 } 1369 }
1373 1370
1371 // Move the toolbar to visible during page load.
1372 // TODO(crbug.com/707305): Do not disable fullscreen for same-document
1373 // navigations.
1374 [_fullScreenController disableFullScreen];
1375
1374 [self.dialogDelegate cancelDialogForTab:self]; 1376 [self.dialogDelegate cancelDialogForTab:self];
1375 [_parentTabModel notifyTabChanged:self]; 1377 [_parentTabModel notifyTabChanged:self];
1376 [_openInController disable]; 1378 [_openInController disable];
1377 [[NSNotificationCenter defaultCenter] 1379 [[NSNotificationCenter defaultCenter]
1378 postNotificationName: 1380 postNotificationName:
1379 kTabClosingCurrentDocumentNotificationForCrashReporting 1381 kTabClosingCurrentDocumentNotificationForCrashReporting
1380 object:self]; 1382 object:self];
1381 } 1383 }
1382 1384
1383 - (void)webState:(web::WebState*)webState 1385 - (void)webState:(web::WebState*)webState
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1812 1814
1813 - (TabModel*)parentTabModel { 1815 - (TabModel*)parentTabModel {
1814 return _parentTabModel; 1816 return _parentTabModel;
1815 } 1817 }
1816 1818
1817 - (FormInputAccessoryViewController*)inputAccessoryViewController { 1819 - (FormInputAccessoryViewController*)inputAccessoryViewController {
1818 return _inputAccessoryViewController; 1820 return _inputAccessoryViewController;
1819 } 1821 }
1820 1822
1821 @end 1823 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698