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

Side by Side Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2628133003: [ios] Made goToItemAtIndex: safe for release builds. (Closed)
Patch Set: Fixed compilaiton Created 3 years, 11 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/web/web_state/ui/crw_web_controller.h" 5 #import "ios/web/web_state/ui/crw_web_controller.h"
6 6
7 #import <WebKit/WebKit.h> 7 #import <WebKit/WebKit.h>
8 8
9 #import <objc/runtime.h> 9 #import <objc/runtime.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 2258 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 [_delegate webLoadCancelled:_URLOnStartLoading]; 2269 [_delegate webLoadCancelled:_URLOnStartLoading];
2270 break; 2270 break;
2271 case web::PAGE_LOADED: 2271 case web::PAGE_LOADED:
2272 break; 2272 break;
2273 } 2273 }
2274 } 2274 }
2275 2275
2276 - (void)goToItemAtIndex:(int)index { 2276 - (void)goToItemAtIndex:(int)index {
2277 CRWSessionController* sessionController = self.sessionController; 2277 CRWSessionController* sessionController = self.sessionController;
2278 NSArray* entries = sessionController.entries; 2278 NSArray* entries = sessionController.entries;
2279 DCHECK_LT(static_cast<NSUInteger>(index), entries.count); 2279 if (index < 0 || index >= static_cast<int>(entries.count)) {
2280 DCHECK_GE(index, 0); 2280 NOTREACHED();
2281 return;
2282 }
2281 2283
2282 if (!_webStateImpl->IsShowingWebInterstitial()) 2284 if (!_webStateImpl->IsShowingWebInterstitial())
2283 [self recordStateInHistory]; 2285 [self recordStateInHistory];
2284 CRWSessionEntry* fromEntry = self.sessionController.currentEntry; 2286 CRWSessionEntry* fromEntry = self.sessionController.currentEntry;
2285 2287
2286 NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults]; 2288 NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
2287 if (![userDefaults boolForKey:@"PendingIndexNavigationDisabled"]) { 2289 if (![userDefaults boolForKey:@"PendingIndexNavigationDisabled"]) {
2288 BOOL sameDocumentNavigation = 2290 BOOL sameDocumentNavigation =
2289 [sessionController isSameDocumentNavigationBetweenEntry:fromEntry 2291 [sessionController isSameDocumentNavigationBetweenEntry:fromEntry
2290 andEntry:entries[index]]; 2292 andEntry:entries[index]];
(...skipping 3477 matching lines...) Expand 10 before | Expand all | Expand 10 after
5768 } 5770 }
5769 5771
5770 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; 5772 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC;
5771 } 5773 }
5772 5774
5773 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { 5775 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action {
5774 return [action.request valueForHTTPHeaderField:@"Referer"]; 5776 return [action.request valueForHTTPHeaderField:@"Referer"];
5775 } 5777 }
5776 5778
5777 @end 5779 @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