Chromium Code Reviews| Index: ios/chrome/browser/passwords/js_password_manager.h |
| diff --git a/ios/chrome/browser/passwords/js_password_manager.h b/ios/chrome/browser/passwords/js_password_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5ee92fa99d86a62f807eefae58ea5596f38a4255 |
| --- /dev/null |
| +++ b/ios/chrome/browser/passwords/js_password_manager.h |
| @@ -0,0 +1,65 @@ |
| +// Copyright 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef IOS_CHROME_BROWSER_PASSWORDS_JS_PASSWORD_MANAGER_H_ |
| +#define IOS_CHROME_BROWSER_PASSWORDS_JS_PASSWORD_MANAGER_H_ |
| + |
| +#include "base/ios/block_types.h" |
| +#import "ios/web/public/web_state/js/crw_js_injection_manager.h" |
| + |
| +@class CRWJSInjectionReceiver; |
| + |
| +// Loads the JavaScript file, password_controller.js, which contains password |
| +// form parsing and autofill functions. It will be evaluated on a page that |
| +// is known to have at least one password form (see hasPasswordForms in |
| +// core.js.) It returns contents of those password forms and also |
| +// registers functions that are later used to autofill them. |
| +@interface JsPasswordManager : CRWJSInjectionManager |
| + |
| +// Finds any password forms on the web page. |
| +// |completionHandler| is then called with the JSON string result (which can |
| +// be a zero-length string if there was an error). |completionHandler| cannot be |
| +// nil. |
| +// For example the JSON string for a form with a single password field is: |
| +// [{"action":null,"method":null,"usernameElement":"","usernameValue":""," |
| +// passwords":[{"element":"","value":"asd"}]}] |
| +- (void)findPasswordFormsWithCompletionHandler: |
| + (void (^)(NSString*))completionHandler; |
| + |
| +// Extracts the password form with the given name from a web page. |
| +// |completionHandler| is called with the JSON string containing the info about |
| +// submitted password forms from a web page (it can be zero-length if there was |
| +// an error). |completionHandler| cannot be nil. |
| +// For example. the JSON string for a form with a single password field is: |
| +// {"action":null,"method":null,"usernameElement":"","usernameValue":"", |
| +// "passwords":[{"element":"","value":"asd"}]} |
| +- (void)extractForm:(NSString*)formName |
| + completionHandler:(void (^)(NSString*))completionHandler; |
|
Eugene But (OOO till 7-30)
2015/11/18 17:06:48
Indent 4 spaces:
https://google.github.io/stylegu
vabr (Chromium)
2015/11/19 10:02:27
Done + filed internal bug 25783407 for clang-forma
|
| + |
| +// Fills in the password form specified by |jsonString| with the given |
|
Eugene But (OOO till 7-30)
2015/11/18 17:06:48
s/jsonString/JSONString
vabr (Chromium)
2015/11/19 10:02:27
Pushing back:
How am I supposed to deduce this fr
Eugene But (OOO till 7-30)
2015/11/19 15:13:21
This is an Objective-C method and you suppose to f
vabr (Chromium)
2015/11/19 16:45:02
Thanks, I missed that paragraph. Makes sense now,
|
| +// |username| and |password|. Assumes JavaScript has been injected previously |
| +// by calling |findPasswordFormsWithCompletionHandle| or |
| +// |extractSubmittedFormWithCompletionHandler|. Calls |completionHandler| with |
| +// YES if the filling of the password was successful, NO otherwise. |
| +// |completionHandler| cannot be nil. |
| +- (void)fillPasswordForm:(NSString*)jsonString |
|
Eugene But (OOO till 7-30)
2015/11/18 17:06:48
s/jsonString/JSONString
vabr (Chromium)
2015/11/19 10:02:27
ditto
vabr (Chromium)
2015/11/19 16:45:02
Done.
|
| + withUsername:(NSString*)username |
| + password:(NSString*)password |
| + completionHandler:(void (^)(BOOL))completionHandler; |
| + |
| +// Clears autofilled credentials in the specified form. Invokes |
| +// |completionHandler| with YES if successful and NO otherwise. |
| +- (void)clearAutofilledPasswordsInForm:(NSString*)formName |
| + completionHandler:(void (^)(BOOL))completionHandler; |
| + |
| +// Fills all password fields in the form identified by |formName| with |
| +// |password| and invokes |completionHandler| with true if any fields were |
| +// filled. |
| +- (void)fillPasswordForm:(NSString*)formName |
| + withGeneratedPassword:(NSString*)password |
| + completionHandler:(void (^)(BOOL))completionHandler; |
| + |
| +@end |
| + |
| +#endif // IOS_CHROME_BROWSER_PASSWORDS_JS_PASSWORD_MANAGER_H_ |