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

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

Issue 2499593003: [ios] Removed back-forward navigation API from CRWWebController. (Closed)
Patch Set: Self review Created 4 years, 1 month 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/web/web_state/ui/crw_web_controller.h ('k') | 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 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 1372
1373 UIImage* result = UIGraphicsGetImageFromCurrentImageContext(); 1373 UIImage* result = UIGraphicsGetImageFromCurrentImageContext();
1374 UIGraphicsEndImageContext(); 1374 UIGraphicsEndImageContext();
1375 1375
1376 defaultImage = 1376 defaultImage =
1377 [[result stretchableImageWithLeftCapWidth:1 topCapHeight:1] retain]; 1377 [[result stretchableImageWithLeftCapWidth:1 topCapHeight:1] retain];
1378 } 1378 }
1379 return defaultImage; 1379 return defaultImage;
1380 } 1380 }
1381 1381
1382 - (BOOL)canGoBack {
1383 return _webStateImpl->GetNavigationManagerImpl().CanGoBack();
1384 }
1385
1386 - (BOOL)canGoForward {
1387 return _webStateImpl->GetNavigationManagerImpl().CanGoForward();
1388 }
1389
1390 - (CGPoint)scrollPosition { 1382 - (CGPoint)scrollPosition {
1391 CGPoint position = CGPointMake(0.0, 0.0); 1383 CGPoint position = CGPointMake(0.0, 0.0);
1392 if (!self.webScrollView) 1384 if (!self.webScrollView)
1393 return position; 1385 return position;
1394 return self.webScrollView.contentOffset; 1386 return self.webScrollView.contentOffset;
1395 } 1387 }
1396 1388
1397 - (BOOL)atTop { 1389 - (BOOL)atTop {
1398 if (!_webView) 1390 if (!_webView)
1399 return YES; 1391 return YES;
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
2274 _URLOnStartLoading, false); 2266 _URLOnStartLoading, false);
2275 _webStateImpl->SetIsLoading(false); 2267 _webStateImpl->SetIsLoading(false);
2276 } 2268 }
2277 [_delegate webLoadCancelled:_URLOnStartLoading]; 2269 [_delegate webLoadCancelled:_URLOnStartLoading];
2278 break; 2270 break;
2279 case web::PAGE_LOADED: 2271 case web::PAGE_LOADED:
2280 break; 2272 break;
2281 } 2273 }
2282 } 2274 }
2283 2275
2284 - (void)goBack {
2285 [self goDelta:-1];
2286 }
2287
2288 - (void)goForward {
2289 [self goDelta:1];
2290 }
2291
2292 - (void)goDelta:(int)delta { 2276 - (void)goDelta:(int)delta {
2293 if (delta == 0) { 2277 if (delta == 0) {
2294 [self reload]; 2278 [self reload];
2295 } else if ([self.sessionController canGoDelta:delta]) { 2279 } else if ([self.sessionController canGoDelta:delta]) {
2296 [self goToItemAtIndex:[self.sessionController indexOfEntryForDelta:delta]]; 2280 [self goToItemAtIndex:[self.sessionController indexOfEntryForDelta:delta]];
2297 } 2281 }
2298 } 2282 }
2299 2283
2300 - (void)goToItemAtIndex:(int)index { 2284 - (void)goToItemAtIndex:(int)index {
2301 NSArray* entries = self.sessionController.entries; 2285 NSArray* entries = self.sessionController.entries;
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
3025 item->SetIsCreatedFromHashChange(true); 3009 item->SetIsCreatedFromHashChange(true);
3026 } 3010 }
3027 3011
3028 // Notify the observers. 3012 // Notify the observers.
3029 _webStateImpl->OnUrlHashChanged(); 3013 _webStateImpl->OnUrlHashChanged();
3030 return YES; 3014 return YES;
3031 } 3015 }
3032 3016
3033 - (BOOL)handleWindowHistoryBackMessage:(base::DictionaryValue*)message 3017 - (BOOL)handleWindowHistoryBackMessage:(base::DictionaryValue*)message
3034 context:(NSDictionary*)context { 3018 context:(NSDictionary*)context {
3035 [self goBack]; 3019 [self goDelta:-1];
3036 return YES; 3020 return YES;
3037 } 3021 }
3038 3022
3039 - (BOOL)handleWindowHistoryForwardMessage:(base::DictionaryValue*)message 3023 - (BOOL)handleWindowHistoryForwardMessage:(base::DictionaryValue*)message
3040 context:(NSDictionary*)context { 3024 context:(NSDictionary*)context {
3041 [self goForward]; 3025 [self goDelta:1];
3042 return YES; 3026 return YES;
3043 } 3027 }
3044 3028
3045 - (BOOL)handleWindowHistoryGoMessage:(base::DictionaryValue*)message 3029 - (BOOL)handleWindowHistoryGoMessage:(base::DictionaryValue*)message
3046 context:(NSDictionary*)context { 3030 context:(NSDictionary*)context {
3047 int delta; 3031 int delta;
3048 message->GetInteger("value", &delta); 3032 message->GetInteger("value", &delta);
3049 [self goDelta:delta]; 3033 [self goDelta:delta];
3050 return YES; 3034 return YES;
3051 } 3035 }
(...skipping 2687 matching lines...) Expand 10 before | Expand all | Expand 10 after
5739 } 5723 }
5740 5724
5741 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; 5725 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC;
5742 } 5726 }
5743 5727
5744 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { 5728 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action {
5745 return [action.request valueForHTTPHeaderField:@"Referer"]; 5729 return [action.request valueForHTTPHeaderField:@"Referer"];
5746 } 5730 }
5747 5731
5748 @end 5732 @end
OLDNEW
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698