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

Unified Diff: ios/web/web_state/ui/web_view_navigation_proxy_impl.mm

Issue 2957163002: [Navigation Experiment] Add WKBasedNavigationManagerImpl. (Closed)
Patch Set: Patch for review Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: ios/web/web_state/ui/web_view_navigation_proxy_impl.mm
diff --git a/ios/web/web_state/ui/web_view_navigation_proxy_impl.mm b/ios/web/web_state/ui/web_view_navigation_proxy_impl.mm
new file mode 100644
index 0000000000000000000000000000000000000000..7ce27f8e27c13652ef2b79b8230ed9ba4c324aa8
--- /dev/null
+++ b/ios/web/web_state/ui/web_view_navigation_proxy_impl.mm
@@ -0,0 +1,56 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import <WebKit/WebKit.h>
+
+#include "ios/web/web_state/ui/web_view_navigation_proxy_impl.h"
+
+namespace web {
+
+WebViewNavigationProxyImpl::WebViewNavigationProxyImpl(WKWebView* web_view)
+ : web_view_(web_view) {}
+
+bool WebViewNavigationProxyImpl::CanGoBack() const {
+ return web_view_ && [web_view_ canGoBack];
+}
+
+bool WebViewNavigationProxyImpl::CanGoForward() const {
+ return web_view_ && [web_view_ canGoForward];
+}
+
+void WebViewNavigationProxyImpl::GoBack() const {
+ [web_view_ goBack];
+}
+
+void WebViewNavigationProxyImpl::GoForward() const {
+ [web_view_ goForward];
+}
+
+void WebViewNavigationProxyImpl::GoToBackForwardListItem(
+ WKBackForwardListItem* item) const {
+ [web_view_ goToBackForwardListItem:item];
+}
+
+WKBackForwardListItem* WebViewNavigationProxyImpl::GetCurrentItem() const {
+ return web_view_.backForwardList.currentItem;
+}
+
+NSArray* WebViewNavigationProxyImpl::GetBackList() const {
+ return web_view_.backForwardList.backList;
+}
+
+NSArray* WebViewNavigationProxyImpl::GetForwardList() const {
+ return web_view_.backForwardList.forwardList;
+}
+
+WKBackForwardListItem* WebViewNavigationProxyImpl::GetItemAtOffset(
+ int offset) const {
+ return [web_view_.backForwardList itemAtIndex:offset];
+}
+
+void WebViewNavigationProxyImpl::SetWebView(WKWebView* web_view) {
+ web_view_ = web_view;
+}
+
+} // namespace web

Powered by Google App Engine
This is Rietveld 408576698