| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef IOS_CHROME_BROWSER_PASSWORDS_PASSWORD_CONTROLLER_H_ | 4 #ifndef IOS_CHROME_BROWSER_PASSWORDS_PASSWORD_CONTROLLER_H_ |
| 5 #define IOS_CHROME_BROWSER_PASSWORDS_PASSWORD_CONTROLLER_H_ | 5 #define IOS_CHROME_BROWSER_PASSWORDS_PASSWORD_CONTROLLER_H_ |
| 6 | 6 |
| 7 #import <Foundation/NSObject.h> | 7 #import <Foundation/NSObject.h> |
| 8 | 8 |
| 9 #import "ios/chrome/browser/autofill/form_suggestion_provider.h" | 9 #import "ios/chrome/browser/autofill/form_suggestion_provider.h" |
| 10 #import "ios/chrome/browser/passwords/ios_chrome_password_manager_client.h" | 10 #import "ios/chrome/browser/passwords/ios_chrome_password_manager_client.h" |
| 11 #import "ios/chrome/browser/passwords/ios_chrome_password_manager_driver.h" | 11 #import "ios/chrome/browser/passwords/ios_chrome_password_manager_driver.h" |
| 12 #import "ios/web/public/web_state/web_state_observer_bridge.h" |
| 12 | 13 |
| 13 @protocol FormInputAccessoryViewProvider; | 14 @protocol FormInputAccessoryViewProvider; |
| 14 @protocol PasswordsUiDelegate; | 15 @protocol PasswordsUiDelegate; |
| 15 @class PasswordGenerationAgent; | 16 @class PasswordGenerationAgent; |
| 16 | 17 |
| 17 namespace password_manager { | 18 namespace password_manager { |
| 18 class PasswordGenerationManager; | 19 class PasswordGenerationManager; |
| 19 class PasswordManager; | 20 class PasswordManager; |
| 20 class PasswordManagerClient; | 21 class PasswordManagerClient; |
| 21 class PasswordManagerDriver; | 22 class PasswordManagerDriver; |
| 22 } // namespace password_manager | 23 } // namespace password_manager |
| 23 | 24 |
| 24 // Per-tab password controller. Handles password autofill and saving. | 25 // Per-tab password controller. Handles password autofill and saving. |
| 25 @interface PasswordController | 26 @interface PasswordController : NSObject<CRWWebStateObserver, |
| 26 : NSObject<PasswordManagerClientDelegate, PasswordManagerDriverDelegate> | 27 PasswordManagerClientDelegate, |
| 28 PasswordManagerDriverDelegate> |
| 27 | 29 |
| 28 // An object that can provide suggestions from this PasswordController. | 30 // An object that can provide suggestions from this PasswordController. |
| 29 @property(readonly) id<FormSuggestionProvider> suggestionProvider; | 31 @property(readonly) id<FormSuggestionProvider> suggestionProvider; |
| 30 | 32 |
| 31 // An object that can provide an input accessory view from this | 33 // An object that can provide an input accessory view from this |
| 32 // PasswordController. | 34 // PasswordController. |
| 33 @property(readonly) id<FormInputAccessoryViewProvider> accessoryViewProvider; | 35 @property(readonly) id<FormInputAccessoryViewProvider> accessoryViewProvider; |
| 34 | 36 |
| 35 // The PasswordGenerationManager owned by this PasswordController. | 37 // The PasswordGenerationManager owned by this PasswordController. |
| 36 @property(readonly) | 38 @property(readonly) |
| 37 password_manager::PasswordGenerationManager* passwordGenerationManager; | 39 password_manager::PasswordGenerationManager* passwordGenerationManager; |
| 38 | 40 |
| 39 // The PasswordManagerClient owned by this PasswordController. | 41 // The PasswordManagerClient owned by this PasswordController. |
| 40 @property(readonly) | 42 @property(readonly) |
| 41 password_manager::PasswordManagerClient* passwordManagerClient; | 43 password_manager::PasswordManagerClient* passwordManagerClient; |
| 42 | 44 |
| 43 // The PasswordManagerDriver owned by this PasswordController. | 45 // The PasswordManagerDriver owned by this PasswordController. |
| 44 @property(readonly) | 46 @property(readonly) |
| 45 password_manager::PasswordManagerDriver* passwordManagerDriver; | 47 password_manager::PasswordManagerDriver* passwordManagerDriver; |
| 46 | 48 |
| 47 // |webState| should not be nil. | 49 // |webState| should not be nil. |
| 48 - (instancetype)initWithWebState:(web::WebState*)webState | 50 - (instancetype)initWithWebState:(web::WebState*)webState |
| 49 passwordsUiDelegate:(id<PasswordsUiDelegate>)UIDelegate | 51 passwordsUiDelegate:(id<PasswordsUiDelegate>)UIDelegate; |
| 50 NS_DESIGNATED_INITIALIZER; | 52 |
| 53 // This is just for testing. |
| 54 - (instancetype) |
| 55 initWithWebState:(web::WebState*)webState |
| 56 passwordsUiDelegate:(id<PasswordsUiDelegate>)UIDelegate |
| 57 client:(scoped_ptr<password_manager::PasswordManagerClient>) |
| 58 passwordManagerClient NS_DESIGNATED_INITIALIZER; |
| 51 | 59 |
| 52 - (instancetype)init NS_UNAVAILABLE; | 60 - (instancetype)init NS_UNAVAILABLE; |
| 53 | 61 |
| 54 // Releases all tab-specific members. Must be called when the Tab is closing, | 62 // Releases all tab-specific members. Must be called when the Tab is closing, |
| 55 // otherwise invalid memory might be accessed during destruction. | 63 // otherwise invalid memory might be accessed during destruction. |
| 56 - (void)detach; | 64 - (void)detach; |
| 57 | 65 |
| 58 // Uses JavaScript to find password forms using the |webState_| and fills | 66 // Uses JavaScript to find password forms using the |webState_| and fills |
| 59 // them with the |username| and |password|. |completionHandler|, if not nil, | 67 // them with the |username| and |password|. |completionHandler|, if not nil, |
| 60 // is called once per form filled. | 68 // is called once per form filled. |
| 61 - (void)findAndFillPasswordForms:(NSString*)username | 69 - (void)findAndFillPasswordForms:(NSString*)username |
| 62 password:(NSString*)password | 70 password:(NSString*)password |
| 63 completionHandler:(void (^)(BOOL))completionHandler; | 71 completionHandler:(void (^)(BOOL))completionHandler; |
| 64 | 72 |
| 65 @end | 73 @end |
| 66 | 74 |
| 67 #endif // IOS_CHROME_BROWSER_PASSWORDS_PASSWORD_CONTROLLER_H_ | 75 #endif // IOS_CHROME_BROWSER_PASSWORDS_PASSWORD_CONTROLLER_H_ |
| OLD | NEW |