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

Unified Diff: ios/chrome/browser/passwords/js_password_manager.h

Issue 1456983002: Move JS-related password manager code upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Indent fixed, capitalisation fixed, typo fixed Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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..260ae2e3118bcb5d6c92a330803702efa7154448
--- /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;
+
+// Fills in the password form specified by |JSONString| with the given
+// |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
+ 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_
« no previous file with comments | « ios/chrome/browser/passwords/js_credential_manager.mm ('k') | ios/chrome/browser/passwords/js_password_manager.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698