| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/ios/browser/js_autofill_manager.h" | 5 #import "components/autofill/ios/browser/js_autofill_manager.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/json/string_escape.h" | 8 #include "base/json/string_escape.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| 11 | 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." |
| 14 #endif |
| 15 |
| 12 @implementation JsAutofillManager | 16 @implementation JsAutofillManager |
| 13 | 17 |
| 14 - (void)fetchFormsWithMinimumRequiredFieldsCount:(NSUInteger)requiredFieldsCount | 18 - (void)fetchFormsWithMinimumRequiredFieldsCount:(NSUInteger)requiredFieldsCount |
| 15 completionHandler: | 19 completionHandler: |
| 16 (void (^)(NSString*))completionHandler { | 20 (void (^)(NSString*))completionHandler { |
| 17 DCHECK(completionHandler); | 21 DCHECK(completionHandler); |
| 18 NSString* extractFormsJS = [NSString | 22 NSString* extractFormsJS = [NSString |
| 19 stringWithFormat:@"__gCrWeb.autofill.extractForms(%" PRIuNS ");", | 23 stringWithFormat:@"__gCrWeb.autofill.extractForms(%" PRIuNS ");", |
| 20 requiredFieldsCount]; | 24 requiredFieldsCount]; |
| 21 [self executeJavaScript:extractFormsJS | 25 [self executeJavaScript:extractFormsJS |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 74 } |
| 71 | 75 |
| 72 - (void)fillPredictionData:(NSString*)dataString { | 76 - (void)fillPredictionData:(NSString*)dataString { |
| 73 NSString* script = | 77 NSString* script = |
| 74 [NSString stringWithFormat:@"__gCrWeb.autofill.fillPredictionData(%@);", | 78 [NSString stringWithFormat:@"__gCrWeb.autofill.fillPredictionData(%@);", |
| 75 dataString]; | 79 dataString]; |
| 76 [self executeJavaScript:script completionHandler:nil]; | 80 [self executeJavaScript:script completionHandler:nil]; |
| 77 } | 81 } |
| 78 | 82 |
| 79 @end | 83 @end |
| OLD | NEW |