Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef IOS_CHROME_BROWSER_PASSWORDS_JS_PASSWORD_MANAGER_H_ | |
| 6 #define IOS_CHROME_BROWSER_PASSWORDS_JS_PASSWORD_MANAGER_H_ | |
| 7 | |
| 8 #include "base/ios/block_types.h" | |
| 9 #import "ios/web/public/web_state/js/crw_js_injection_manager.h" | |
| 10 | |
| 11 @class CRWJSInjectionReceiver; | |
| 12 | |
| 13 // Loads the JavaScript file, password_controller.js, which contains password | |
| 14 // form parsing and autofill functions. It will be evaluated on a page that | |
| 15 // is known to have at least one password form (see hasPasswordForms in | |
| 16 // core.js.) It returns contents of those password forms and also | |
| 17 // registers functions that are later used to autofill them. | |
| 18 @interface JsPasswordManager : CRWJSInjectionManager | |
| 19 | |
| 20 // Finds any password forms on the web page. | |
| 21 // |completionHandler| is then called with the JSON string result (which can | |
| 22 // be a zero-length string if there was an error). |completionHandler| cannot be | |
| 23 // nil. | |
| 24 // For example the JSON string for a form with a single password field is: | |
| 25 // [{"action":null,"method":null,"usernameElement":"","usernameValue":""," | |
| 26 // passwords":[{"element":"","value":"asd"}]}] | |
| 27 - (void)findPasswordFormsWithCompletionHandler: | |
| 28 (void (^)(NSString*))completionHandler; | |
| 29 | |
| 30 // Extracts the password form with the given name from a web page. | |
| 31 // |completionHandler| is called with the JSON string containing the info about | |
| 32 // submitted password forms from a web page (it can be zero-length if there was | |
| 33 // an error). |completionHandler| cannot be nil. | |
| 34 // For example. the JSON string for a form with a single password field is: | |
| 35 // {"action":null,"method":null,"usernameElement":"","usernameValue":"", | |
| 36 // "passwords":[{"element":"","value":"asd"}]} | |
| 37 - (void)extractForm:(NSString*)formName | |
| 38 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
| |
| 39 | |
| 40 // 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,
| |
| 41 // |username| and |password|. Assumes JavaScript has been injected previously | |
| 42 // by calling |findPasswordFormsWithCompletionHandle| or | |
| 43 // |extractSubmittedFormWithCompletionHandler|. Calls |completionHandler| with | |
| 44 // YES if the filling of the password was successful, NO otherwise. | |
| 45 // |completionHandler| cannot be nil. | |
| 46 - (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.
| |
| 47 withUsername:(NSString*)username | |
| 48 password:(NSString*)password | |
| 49 completionHandler:(void (^)(BOOL))completionHandler; | |
| 50 | |
| 51 // Clears autofilled credentials in the specified form. Invokes | |
| 52 // |completionHandler| with YES if successful and NO otherwise. | |
| 53 - (void)clearAutofilledPasswordsInForm:(NSString*)formName | |
| 54 completionHandler:(void (^)(BOOL))completionHandler; | |
| 55 | |
| 56 // Fills all password fields in the form identified by |formName| with | |
| 57 // |password| and invokes |completionHandler| with true if any fields were | |
| 58 // filled. | |
| 59 - (void)fillPasswordForm:(NSString*)formName | |
| 60 withGeneratedPassword:(NSString*)password | |
| 61 completionHandler:(void (^)(BOOL))completionHandler; | |
| 62 | |
| 63 @end | |
| 64 | |
| 65 #endif // IOS_CHROME_BROWSER_PASSWORDS_JS_PASSWORD_MANAGER_H_ | |
| OLD | NEW |