123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- // 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 COMPONENTS_PASSWORD_MANAGER_IOS_SHARED_PASSWORD_CONTROLLER_H_
- #define COMPONENTS_PASSWORD_MANAGER_IOS_SHARED_PASSWORD_CONTROLLER_H_
- #import <Foundation/Foundation.h>
- #import "components/autofill/ios/browser/form_suggestion_provider.h"
- #import "components/autofill/ios/form_util/form_activity_observer.h"
- #include "components/password_manager/core/browser/password_manager_interface.h"
- #import "components/password_manager/ios/password_form_helper.h"
- #import "components/password_manager/ios/password_generation_provider.h"
- #import "components/password_manager/ios/password_manager_driver_bridge.h"
- #import "components/password_manager/ios/password_suggestion_helper.h"
- #import "ios/web/public/web_state_observer_bridge.h"
- namespace password_manager {
- class PasswordManagerClient;
- class PasswordManagerDriver;
- } // namespace password_manager
- @class FormSuggestion;
- @class SharedPasswordController;
- // Protocol to define methods that must be implemented by the embedder.
- @protocol SharedPasswordControllerDelegate <NSObject>
- // The PasswordManagerClient owned by the delegate.
- @property(nonatomic, readonly)
- password_manager::PasswordManagerClient* passwordManagerClient;
- // The PasswordManagerClient owned by the delegate.
- @property(nonatomic, readonly)
- password_manager::PasswordManagerDriver* passwordManagerDriver;
- // Called to inform the delegate that it should prompt the user for a decision
- // on whether or not to use the |generatedPotentialPassword|.
- // |decisionHandler| takes a single BOOL indicating if the user accepted the
- // the suggested |generatedPotentialPassword|.
- - (void)sharedPasswordController:(SharedPasswordController*)controller
- showGeneratedPotentialPassword:(NSString*)generatedPotentialPassword
- decisionHandler:(void (^)(BOOL accept))decisionHandler;
- // Called when SharedPasswordController accepts a suggestion displayed to the
- // user. This can be used to additional client specific behavior.
- - (void)sharedPasswordController:(SharedPasswordController*)controller
- didAcceptSuggestion:(FormSuggestion*)suggestion;
- @end
- // Per-tab shared password controller. Handles parsing forms, loading
- // suggestions, filling forms, and generating passwords.
- @interface SharedPasswordController
- : NSObject <CRWWebStateObserver,
- FormActivityObserver,
- FormSuggestionProvider,
- PasswordFormHelperDelegate,
- PasswordGenerationProvider,
- PasswordManagerDriverBridge,
- PasswordSuggestionHelperDelegate>
- // Helper contains common password form processing logic.
- @property(nonatomic, readonly) PasswordFormHelper* formHelper;
- // Delegate to receive callbacks from this class.
- @property(nonatomic, weak) id<SharedPasswordControllerDelegate> delegate;
- - (instancetype)initWithWebState:(web::WebState*)webState
- manager:(password_manager::PasswordManagerInterface*)
- passwordManager
- formHelper:(PasswordFormHelper*)formHelper
- suggestionHelper:(PasswordSuggestionHelper*)suggestionHelper
- NS_DESIGNATED_INITIALIZER;
- - (instancetype)init NS_UNAVAILABLE;
- @end
- #endif // COMPONENTS_PASSWORD_MANAGER_IOS_SHARED_PASSWORD_CONTROLLER_H_
|