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

Side by Side Diff: components/autofill/ios/browser/js_autofill_manager.mm

Issue 1137403002: Add upstream bits necessary for iOS card unmask prompt. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add clearActiveElement to autofill_controller.js Created 5 years, 7 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 unified diff | Download patch
OLDNEW
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 10
(...skipping 29 matching lines...) Expand all
40 #pragma mark ProtectedMethods 40 #pragma mark ProtectedMethods
41 41
42 - (NSString*)scriptPath { 42 - (NSString*)scriptPath {
43 return @"autofill_controller"; 43 return @"autofill_controller";
44 } 44 }
45 45
46 - (NSString*)presenceBeacon { 46 - (NSString*)presenceBeacon {
47 return @"__gCrWeb.autofill"; 47 return @"__gCrWeb.autofill";
48 } 48 }
49 49
50 - (void)storeActiveElement {
51 NSString* js = @"__gCrWeb.autofill.storeActiveElement()";
52 [self evaluate:js stringResultHandler:nil];
53 }
54
55 - (void)clearActiveElement {
56 NSString* js = @"__gCrWeb.autofill.clearActiveElement()";
57 [self evaluate:js stringResultHandler:nil];
58 }
59
50 - (void)fillActiveFormField:(NSString*)dataString 60 - (void)fillActiveFormField:(NSString*)dataString
51 completionHandler:(ProceduralBlock)completionHandler { 61 completionHandler:(ProceduralBlock)completionHandler {
52 web::JavaScriptCompletion resultHandler = ^void(NSString*, NSError*) { 62 web::JavaScriptCompletion resultHandler = ^void(NSString*, NSError*) {
53 completionHandler(); 63 completionHandler();
54 }; 64 };
55 65
56 NSString* js = 66 NSString* js =
57 [NSString stringWithFormat:@"__gCrWeb.autofill.fillActiveFormField(%@);", 67 [NSString stringWithFormat:@"__gCrWeb.autofill.fillActiveFormField(%@);",
58 dataString]; 68 dataString];
59 [self evaluate:js stringResultHandler:resultHandler]; 69 [self evaluate:js stringResultHandler:resultHandler];
(...skipping 29 matching lines...) Expand all
89 } 99 }
90 100
91 - (void)fillPredictionData:(NSString*)dataString { 101 - (void)fillPredictionData:(NSString*)dataString {
92 [self deferredEvaluate: 102 [self deferredEvaluate:
93 [NSString 103 [NSString
94 stringWithFormat:@"__gCrWeb.autofill.fillPredictionData(%@);", 104 stringWithFormat:@"__gCrWeb.autofill.fillPredictionData(%@);",
95 dataString]]; 105 dataString]];
96 } 106 }
97 107
98 @end 108 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698