| 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 2672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2683 return YES; | 2683 return YES; |
| 2684 } | 2684 } |
| 2685 | 2685 |
| 2686 - (BOOL)handleDocumentSubmitMessage:(base::DictionaryValue*)message | 2686 - (BOOL)handleDocumentSubmitMessage:(base::DictionaryValue*)message |
| 2687 context:(NSDictionary*)context { | 2687 context:(NSDictionary*)context { |
| 2688 std::string href; | 2688 std::string href; |
| 2689 if (!message->GetString("href", &href)) { | 2689 if (!message->GetString("href", &href)) { |
| 2690 DLOG(WARNING) << "JS message parameter not found: href"; | 2690 DLOG(WARNING) << "JS message parameter not found: href"; |
| 2691 return NO; | 2691 return NO; |
| 2692 } | 2692 } |
| 2693 const GURL targetURL(href); | |
| 2694 const GURL currentURL([self currentURL]); | |
| 2695 bool targetsFrame = false; | |
| 2696 message->GetBoolean("targetsFrame", &targetsFrame); | |
| 2697 if (!targetsFrame && web::UrlHasWebScheme(targetURL)) { | |
| 2698 // The referrer is not known yet, and will be updated later. | |
| 2699 const web::Referrer emptyReferrer; | |
| 2700 [self registerLoadRequest:targetURL | |
| 2701 referrer:emptyReferrer | |
| 2702 transition:ui::PAGE_TRANSITION_FORM_SUBMIT]; | |
| 2703 } | |
| 2704 std::string formName; | 2693 std::string formName; |
| 2705 message->GetString("formName", &formName); | 2694 message->GetString("formName", &formName); |
| 2706 base::scoped_nsobject<NSSet> observers([_observers copy]); | 2695 base::scoped_nsobject<NSSet> observers([_observers copy]); |
| 2707 // We decide the form is user-submitted if the user has interacted with | 2696 // We decide the form is user-submitted if the user has interacted with |
| 2708 // the main page (using logic from the popup blocker), or if the keyboard | 2697 // the main page (using logic from the popup blocker), or if the keyboard |
| 2709 // is visible. | 2698 // is visible. |
| 2710 BOOL submittedByUser = [context[kUserIsInteractingKey] boolValue] || | 2699 BOOL submittedByUser = [context[kUserIsInteractingKey] boolValue] || |
| 2711 [_webViewProxy keyboardAccessory]; | 2700 [_webViewProxy keyboardAccessory]; |
| 2712 _webStateImpl->OnDocumentSubmitted(formName, submittedByUser); | 2701 _webStateImpl->OnDocumentSubmitted(formName, submittedByUser); |
| 2713 return YES; | 2702 return YES; |
| (...skipping 2526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5240 - (void)simulateLoadRequestWithURL:(const GURL&)URL { | 5229 - (void)simulateLoadRequestWithURL:(const GURL&)URL { |
| 5241 _lastRegisteredRequestURL = URL; | 5230 _lastRegisteredRequestURL = URL; |
| 5242 _loadPhase = web::LOAD_REQUESTED; | 5231 _loadPhase = web::LOAD_REQUESTED; |
| 5243 } | 5232 } |
| 5244 | 5233 |
| 5245 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { | 5234 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { |
| 5246 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; | 5235 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; |
| 5247 } | 5236 } |
| 5248 | 5237 |
| 5249 @end | 5238 @end |
| OLD | NEW |