OLD | NEW |
---|---|
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 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2022 | 2022 |
2023 // Initiating a navigation from the UI, record the current page state before | 2023 // Initiating a navigation from the UI, record the current page state before |
2024 // the new page loads. Don't record for back/forward, as the current entry | 2024 // the new page loads. Don't record for back/forward, as the current entry |
2025 // has already been moved to the next entry in the history. Do, however, | 2025 // has already been moved to the next entry in the history. Do, however, |
2026 // record it for general reload. | 2026 // record it for general reload. |
2027 // TODO(jimblackler): consider a single unified call to record state whenever | 2027 // TODO(jimblackler): consider a single unified call to record state whenever |
2028 // the page is about to be changed. This cannot currently be done after | 2028 // the page is about to be changed. This cannot currently be done after |
2029 // addPendingEntry is called. | 2029 // addPendingEntry is called. |
2030 | 2030 |
2031 [_delegate webWillInitiateLoadWithParams:params]; | 2031 [_delegate webWillInitiateLoadWithParams:params]; |
2032 if ([self.nativeController respondsToSelector:@selector(willBeDismissed)]) { | |
2033 [self.nativeController willBeDismissed]; | |
Eugene But (OOO till 7-30)
2016/12/19 17:52:32
There are probably other cases when this needs to
Olivier
2016/12/19 18:26:38
Done.
| |
2034 } | |
2032 | 2035 |
2033 GURL navUrl = params.url; | 2036 GURL navUrl = params.url; |
2034 ui::PageTransition transition = params.transition_type; | 2037 ui::PageTransition transition = params.transition_type; |
2035 | 2038 |
2036 BOOL initialNavigation = NO; | 2039 BOOL initialNavigation = NO; |
2037 BOOL forwardBack = | 2040 BOOL forwardBack = |
2038 PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_RELOAD) && | 2041 PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_RELOAD) && |
2039 (transition & ui::PAGE_TRANSITION_FORWARD_BACK); | 2042 (transition & ui::PAGE_TRANSITION_FORWARD_BACK); |
2040 if (forwardBack) { | 2043 if (forwardBack) { |
2041 // Setting these for back/forward is not supported. | 2044 // Setting these for back/forward is not supported. |
(...skipping 2003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4045 // can be moved here, using public NavigationManager getters. That's not | 4048 // can be moved here, using public NavigationManager getters. That's not |
4046 // done now in order to avoid code duplication. | 4049 // done now in order to avoid code duplication. |
4047 return [[self currentSessionEntry] navigationItem]; | 4050 return [[self currentSessionEntry] navigationItem]; |
4048 } | 4051 } |
4049 | 4052 |
4050 - (const GURL&)currentNavigationURL { | 4053 - (const GURL&)currentNavigationURL { |
4051 // TODO(stuartmorgan): Fix the fact that this method doesn't have clear usage | 4054 // TODO(stuartmorgan): Fix the fact that this method doesn't have clear usage |
4052 // delination that would allow changing to one of the non-deprecated URL | 4055 // delination that would allow changing to one of the non-deprecated URL |
4053 // calls. | 4056 // calls. |
4054 web::NavigationItem* item = [self currentNavItem]; | 4057 web::NavigationItem* item = [self currentNavItem]; |
4055 return item ? item->GetVirtualURL() : GURL::EmptyGURL(); | 4058 return item ? item->GetURL() : GURL::EmptyGURL(); |
4056 } | 4059 } |
4057 | 4060 |
4058 - (ui::PageTransition)currentTransition { | 4061 - (ui::PageTransition)currentTransition { |
4059 if ([self currentNavItem]) | 4062 if ([self currentNavItem]) |
4060 return [self currentNavItem]->GetTransitionType(); | 4063 return [self currentNavItem]->GetTransitionType(); |
4061 else | 4064 else |
4062 return ui::PageTransitionFromInt(0); | 4065 return ui::PageTransitionFromInt(0); |
4063 } | 4066 } |
4064 | 4067 |
4065 - (web::Referrer)currentSessionEntryReferrer { | 4068 - (web::Referrer)currentSessionEntryReferrer { |
(...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5792 } | 5795 } |
5793 | 5796 |
5794 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 5797 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
5795 } | 5798 } |
5796 | 5799 |
5797 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { | 5800 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { |
5798 return [action.request valueForHTTPHeaderField:@"Referer"]; | 5801 return [action.request valueForHTTPHeaderField:@"Referer"]; |
5799 } | 5802 } |
5800 | 5803 |
5801 @end | 5804 @end |
OLD | NEW |