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

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

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