Skip to content

Commit

Permalink
[iOS] Migrate CWVAutofillDataManager to PasswordStoreInterface
Browse files Browse the repository at this point in the history
PasswordStoreInterface is an interface that should be used by other
classes instead of interacting directly with PasswordStore.

Bug: 1218413
Change-Id: Iaf9b3dda9c1df2f3a44abf20031a377bf3574a23
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3076564
Reviewed-by: John Wu <jzw@chromium.org>
Commit-Queue: Maria Kazinova <kazinova@google.com>
Cr-Commit-Position: refs/heads/master@{#909733}
  • Loading branch information
Maria Kazinova authored and Chromium LUCI CQ committed Aug 9, 2021
1 parent ce11157 commit 1f719c5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
7 changes: 4 additions & 3 deletions ios/web_view/internal/autofill/cwv_autofill_data_manager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,16 @@ @implementation CWVAutofillDataManager {
// Holds weak observers.
NSHashTable<id<CWVAutofillDataManagerObserver>>* _observers;

password_manager::PasswordStore* _passwordStore;
password_manager::PasswordStoreInterface* _passwordStore;
std::unique_ptr<ios_web_view::WebViewPasswordStoreConsumer>
_passwordStoreConsumer;
}

- (instancetype)initWithPersonalDataManager:
(autofill::PersonalDataManager*)personalDataManager
passwordStore:(password_manager::PasswordStore*)
passwordStore {
passwordStore:
(password_manager::PasswordStoreInterface*)
passwordStore {
self = [super init];
if (self) {
_personalDataManager = personalDataManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PersonalDataManager;
} // namespace autofill;

namespace password_manager {
class PasswordStore;
class PasswordStoreInterface;
} // password_manager

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -24,9 +24,9 @@ NS_ASSUME_NONNULL_BEGIN
// It should outlive this instance.
- (instancetype)initWithPersonalDataManager:
(autofill::PersonalDataManager*)personalDataManager
passwordStore:(password_manager::PasswordStore*)
passwordStore
NS_DESIGNATED_INITIALIZER;
passwordStore:
(password_manager::PasswordStoreInterface*)
passwordStore NS_DESIGNATED_INITIALIZER;

@end

Expand Down
7 changes: 4 additions & 3 deletions ios/web_view/internal/cwv_web_view_configuration.mm
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,10 @@ - (CWVAutofillDataManager*)autofillDataManager {
autofill::PersonalDataManager* personalDataManager =
ios_web_view::WebViewPersonalDataManagerFactory::GetForBrowserState(
self.browserState);
scoped_refptr<password_manager::PasswordStore> passwordStore =
ios_web_view::WebViewAccountPasswordStoreFactory::GetForBrowserState(
self.browserState, ServiceAccessType::EXPLICIT_ACCESS);
scoped_refptr<password_manager::PasswordStoreInterface> passwordStore =
ios_web_view::WebViewAccountPasswordStoreFactory::
GetInterfaceForBrowserState(self.browserState,
ServiceAccessType::EXPLICIT_ACCESS);
_autofillDataManager = [[CWVAutofillDataManager alloc]
initWithPersonalDataManager:personalDataManager
passwordStore:passwordStore.get()];
Expand Down

0 comments on commit 1f719c5

Please sign in to comment.