Chromium Code Reviews| 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 2540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2551 return YES; | 2551 return YES; |
| 2552 } | 2552 } |
| 2553 | 2553 |
| 2554 - (BOOL)handleDocumentSubmitMessage:(base::DictionaryValue*)message | 2554 - (BOOL)handleDocumentSubmitMessage:(base::DictionaryValue*)message |
| 2555 context:(NSDictionary*)context { | 2555 context:(NSDictionary*)context { |
| 2556 std::string href; | 2556 std::string href; |
| 2557 if (!message->GetString("href", &href)) { | 2557 if (!message->GetString("href", &href)) { |
| 2558 DLOG(WARNING) << "JS message parameter not found: href"; | 2558 DLOG(WARNING) << "JS message parameter not found: href"; |
| 2559 return NO; | 2559 return NO; |
| 2560 } | 2560 } |
| 2561 const GURL targetURL(href); | |
| 2562 const GURL currentURL([self currentURL]); | |
| 2563 bool targetsFrame = false; | |
| 2564 message->GetBoolean("targetsFrame", &targetsFrame); | |
|
Eugene But (OOO till 7-30)
2017/03/28 18:47:42
Do we also need to remove targetsFrame from JavaSc
michaeldo
2017/03/29 22:53:37
Good call, I removed it and updated description. P
| |
| 2565 if (!targetsFrame && web::UrlHasWebScheme(targetURL)) { | |
| 2566 // The referrer is not known yet, and will be updated later. | |
| 2567 const web::Referrer emptyReferrer; | |
| 2568 [self registerLoadRequest:targetURL | |
| 2569 referrer:emptyReferrer | |
| 2570 transition:ui::PAGE_TRANSITION_FORM_SUBMIT]; | |
| 2571 } | |
| 2572 std::string formName; | 2561 std::string formName; |
| 2573 message->GetString("formName", &formName); | 2562 message->GetString("formName", &formName); |
| 2574 base::scoped_nsobject<NSSet> observers([_observers copy]); | 2563 base::scoped_nsobject<NSSet> observers([_observers copy]); |
| 2575 // We decide the form is user-submitted if the user has interacted with | 2564 // We decide the form is user-submitted if the user has interacted with |
| 2576 // the main page (using logic from the popup blocker), or if the keyboard | 2565 // the main page (using logic from the popup blocker), or if the keyboard |
| 2577 // is visible. | 2566 // is visible. |
| 2578 BOOL submittedByUser = [context[kUserIsInteractingKey] boolValue] || | 2567 BOOL submittedByUser = [context[kUserIsInteractingKey] boolValue] || |
| 2579 [_webViewProxy keyboardAccessory]; | 2568 [_webViewProxy keyboardAccessory]; |
| 2580 _webStateImpl->OnDocumentSubmitted(formName, submittedByUser); | 2569 _webStateImpl->OnDocumentSubmitted(formName, submittedByUser); |
| 2581 return YES; | 2570 return YES; |
| (...skipping 2516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5098 - (void)simulateLoadRequestWithURL:(const GURL&)URL { | 5087 - (void)simulateLoadRequestWithURL:(const GURL&)URL { |
| 5099 _lastRegisteredRequestURL = URL; | 5088 _lastRegisteredRequestURL = URL; |
| 5100 _loadPhase = web::LOAD_REQUESTED; | 5089 _loadPhase = web::LOAD_REQUESTED; |
| 5101 } | 5090 } |
| 5102 | 5091 |
| 5103 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { | 5092 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { |
| 5104 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; | 5093 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; |
| 5105 } | 5094 } |
| 5106 | 5095 |
| 5107 @end | 5096 @end |
| OLD | NEW |