summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreugenebut <eugenebut@chromium.org>2016-03-25 15:29:14 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-25 22:31:45 +0000
commitc1b7e26ae910bd1496bd80f61b11f8f831e20c65 (patch)
tree53b0428840df654e93a798b593dd9177b5379f8b
parent4c94be22307df94b2da87ce920880ada92c28efe (diff)
downloadchromium_src-c1b7e26ae910bd1496bd80f61b11f8f831e20c65.zip
chromium_src-c1b7e26ae910bd1496bd80f61b11f8f831e20c65.tar.gz
chromium_src-c1b7e26ae910bd1496bd80f61b11f8f831e20c65.tar.bz2
[ios] Switched web shell to use WebState for view and navigation.
- Use WebState::GetView() instead of -[CRWWebController view] - Use web::NavigationManager for navigation BUG=597997 Review URL: https://codereview.chromium.org/1833983002 Cr-Commit-Position: refs/heads/master@{#383386}
-rw-r--r--ios/web/shell/view_controller.mm24
1 files changed, 16 insertions, 8 deletions
diff --git a/ios/web/shell/view_controller.mm b/ios/web/shell/view_controller.mm
index c3be325..9460538 100644
--- a/ios/web/shell/view_controller.mm
+++ b/ios/web/shell/view_controller.mm
@@ -40,6 +40,7 @@ NSString* const kWebShellAddressFieldAccessibilityLabel = @"Address field";
base::mac::ObjCPropertyReleaser _propertyReleaser_ViewController;
}
+@property(nonatomic, assign, readonly) web::WebState* webState;
@property(nonatomic, readwrite, retain) UITextField* field;
@end
@@ -118,14 +119,19 @@ NSString* const kWebShellAddressFieldAccessibilityLabel = @"Address field";
[_webController setUIDelegate:self];
[_webController setWebUsageEnabled:YES];
- [[_webController view] setFrame:[_containerView bounds]];
- [_containerView addSubview:[_webController view]];
+ UIView* view = self.webState->GetView();
+ [view setFrame:[_containerView bounds]];
+ [_containerView addSubview:view];
web::WebLoadParams params(GURL("https://dev.chromium.org/"));
params.transition_type = ui::PAGE_TRANSITION_TYPED;
[_webController loadWithParams:params];
}
+- (web::WebState*)webState {
+ return [_webController webState];
+}
+
- (void)setUpNetworkStack {
// Disable the default cache.
[NSURLCache setSharedURLCache:[EmptyNSURLCache emptyNSURLCache]];
@@ -159,14 +165,16 @@ NSString* const kWebShellAddressFieldAccessibilityLabel = @"Address field";
}
- (void)back {
- if ([_webController canGoBack]) {
- [_webController goBack];
+ web::NavigationManager* navManager = self.webState->GetNavigationManager();
+ if (navManager->CanGoBack()) {
+ navManager->GoBack();
}
}
- (void)forward {
- if ([_webController canGoForward]) {
- [_webController goForward];
+ web::NavigationManager* navManager = self.webState->GetNavigationManager();
+ if (navManager->CanGoForward()) {
+ navManager->GoForward();
}
}
@@ -191,8 +199,8 @@ NSString* const kWebShellAddressFieldAccessibilityLabel = @"Address field";
return;
}
- const GURL& url = [_webController webStateImpl]->GetVisibleURL();
- [_field setText:base::SysUTF8ToNSString(url.spec())];
+ const GURL& visibleURL = self.webState->GetVisibleURL();
+ [_field setText:base::SysUTF8ToNSString(visibleURL.spec())];
}
// -----------------------------------------------------------------------