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

Unified Diff: ios/web/web_state/navigation_handle_impl.mm

Issue 2698413004: Implemented WebStateObserver::DidFinishNavigation(NavigationHandle*). (Closed)
Patch Set: Self review Created 3 years, 10 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/navigation_handle_impl.mm
diff --git a/ios/web/web_state/navigation_handle_impl.mm b/ios/web/web_state/navigation_handle_impl.mm
new file mode 100644
index 0000000000000000000000000000000000000000..4bb51b894b8151580181b4533041721bd2cde0b6
--- /dev/null
+++ b/ios/web/web_state/navigation_handle_impl.mm
@@ -0,0 +1,62 @@
+// 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.
+
+#include "ios/web/web_state/navigation_handle_impl.h"
+
+#include "base/memory/ptr_util.h"
+
+namespace web {
+
+// static
+std::unique_ptr<NavigationHandle> NavigationHandleImpl::CreateNavigationHandle(
+ WebState* web_state,
+ const GURL& url) {
+ return base::MakeUnique<NavigationHandleImpl>(
+ web_state, url, false /* is_same_page */, false /* is_error_page */);
+}
+
+// static
+std::unique_ptr<NavigationHandle>
+NavigationHandleImpl::CreateSamePageNavigationHandle(WebState* web_state,
+ const GURL& url) {
+ return base::MakeUnique<NavigationHandleImpl>(
+ web_state, url, true /* is_same_page */, false /* is_error_page */);
+}
+
+// static
+std::unique_ptr<NavigationHandle>
+NavigationHandleImpl::CreateErrorPageNavigationHandle(WebState* web_state,
+ const GURL& url) {
+ return base::MakeUnique<NavigationHandleImpl>(
+ web_state, url, false /* is_same_page */, true /* is_error_page */);
+}
+
+NavigationHandleImpl::NavigationHandleImpl(WebState* web_state,
+ const GURL& url,
+ bool is_same_page,
+ bool is_error_page)
+ : web_state_(web_state),
+ url_(url),
+ is_same_page_(is_same_page),
+ is_error_page_(is_error_page) {}
+
+NavigationHandleImpl::~NavigationHandleImpl() = default;
+
+WebState* NavigationHandleImpl::GetWebState() {
+ return web_state_;
+}
+
+const GURL& NavigationHandleImpl::GetUrl() const {
+ return url_;
+}
+
+bool NavigationHandleImpl::IsSamePage() const {
+ return is_same_page_;
+}
+
+bool NavigationHandleImpl::IsErrorPage() const {
+ return is_error_page_;
+}
+
+} // namespace web

Powered by Google App Engine
This is Rietveld 408576698