Commit fab87547 authored by Viktor Semeniuk's avatar Viktor Semeniuk Committed by Commit Bot

[iOS] Clean up after enabling Password Check feature

Bug: 1096986
Change-Id: Ic4d55f8b041a09db22baea5ae49a0d5c3afe78d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505753Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Viktor Semeniuk <vsemeniuk@google.com>
Cr-Commit-Position: refs/heads/master@{#822193}
parent d3660dd3
...@@ -549,9 +549,6 @@ const flags_ui::FeatureEntry kFeatureEntries[] = { ...@@ -549,9 +549,6 @@ const flags_ui::FeatureEntry kFeatureEntries[] = {
flags_ui::kOsIos, flags_ui::kOsIos,
FEATURE_VALUE_TYPE( FEATURE_VALUE_TYPE(
autofill::features::kAutofillEnableCardNicknameManagement)}, autofill::features::kAutofillEnableCardNicknameManagement)},
{"password-check", flag_descriptions::kPasswordCheckName,
flag_descriptions::kPasswordCheckDescription, flags_ui::kOsIos,
FEATURE_VALUE_TYPE(password_manager::features::kPasswordCheck)},
{"enable-ios-managed-settings-ui", {"enable-ios-managed-settings-ui",
flag_descriptions::kEnableIOSManagedSettingsUIName, flag_descriptions::kEnableIOSManagedSettingsUIName,
flag_descriptions::kEnableIOSManagedSettingsUIDescription, flag_descriptions::kEnableIOSManagedSettingsUIDescription,
......
...@@ -397,10 +397,6 @@ const char kOpenDownloadsInFilesAppDescription[] = ...@@ -397,10 +397,6 @@ const char kOpenDownloadsInFilesAppDescription[] =
"the tools menu or after pressing the 'Open in downloads' button invoked " "the tools menu or after pressing the 'Open in downloads' button invoked "
"by pressing 'Open In...' after download completes."; "by pressing 'Open In...' after download completes.";
const char kPasswordCheckName[] = "Bulk Password Check";
const char kPasswordCheckDescription[] =
"Enables the Bulk Password Check feature for signed-in users.";
const char kPageInfoRefactoringName[] = "New design of the page info"; const char kPageInfoRefactoringName[] = "New design of the page info";
const char kPageInfoRefactoringDescription[] = const char kPageInfoRefactoringDescription[] =
"Uses the new design for the page security info."; "Uses the new design for the page security info.";
......
...@@ -347,11 +347,6 @@ extern const char kOmniboxOnFocusSuggestionsDescription[]; ...@@ -347,11 +347,6 @@ extern const char kOmniboxOnFocusSuggestionsDescription[];
extern const char kOpenDownloadsInFilesAppName[]; extern const char kOpenDownloadsInFilesAppName[];
extern const char kOpenDownloadsInFilesAppDescription[]; extern const char kOpenDownloadsInFilesAppDescription[];
// Title and description for the flag to provide user with Password Check
// feature in Settings.
extern const char kPasswordCheckName[];
extern const char kPasswordCheckDescription[];
// Title and description for the flag to enable the new design of the page info. // Title and description for the flag to enable the new design of the page info.
extern const char kPageInfoRefactoringName[]; extern const char kPageInfoRefactoringName[];
extern const char kPageInfoRefactoringDescription[]; extern const char kPageInfoRefactoringDescription[];
......
...@@ -63,12 +63,9 @@ using password_manager::CredentialLeakType; ...@@ -63,12 +63,9 @@ using password_manager::CredentialLeakType;
if (@available(iOS 13, *)) { if (@available(iOS 13, *)) {
self.viewController.modalInPresentation = YES; self.viewController.modalInPresentation = YES;
} }
id<ApplicationCommands> handler = HandlerForProtocol(
self.browser->GetCommandDispatcher(), ApplicationCommands);
self.mediator = self.mediator =
[[PasswordBreachMediator alloc] initWithConsumer:self.viewController [[PasswordBreachMediator alloc] initWithConsumer:self.viewController
presenter:self presenter:self
handler:handler
URL:_url URL:_url
leakType:self.leakType]; leakType:self.leakType];
self.viewController.actionHandler = self.mediator; self.viewController.actionHandler = self.mediator;
......
...@@ -63,11 +63,6 @@ id<GREYMatcher> CheckPasswordButton() { ...@@ -63,11 +63,6 @@ id<GREYMatcher> CheckPasswordButton() {
// Tests that Check password button redirects to the Passwords List. // Tests that Check password button redirects to the Passwords List.
- (void)testPasswordBreachRedirectToPasswords { - (void)testPasswordBreachRedirectToPasswords {
// TODO(crbug.com/1096986): Remove it once feature is enabled by default.
AppLaunchConfiguration config;
config.features_enabled.push_back(password_manager::features::kPasswordCheck);
[[AppLaunchManager sharedManager] ensureAppLaunchedWithConfiguration:config];
[PasswordBreachAppInterface showPasswordBreachWithCheckButton:YES]; [PasswordBreachAppInterface showPasswordBreachWithCheckButton:YES];
[[EarlGrey selectElementWithMatcher:PasswordBreachMatcher()] [[EarlGrey selectElementWithMatcher:PasswordBreachMatcher()]
assertWithMatcher:grey_notNil()]; assertWithMatcher:grey_notNil()];
......
...@@ -21,7 +21,6 @@ class GURL; ...@@ -21,7 +21,6 @@ class GURL;
- (instancetype)initWithConsumer:(id<PasswordBreachConsumer>)consumer - (instancetype)initWithConsumer:(id<PasswordBreachConsumer>)consumer
presenter:(id<PasswordBreachPresenter>)presenter presenter:(id<PasswordBreachPresenter>)presenter
handler:(id<ApplicationCommands>)handler
URL:(const GURL&)URL URL:(const GURL&)URL
leakType:(password_manager::CredentialLeakType)leakType; leakType:(password_manager::CredentialLeakType)leakType;
......
...@@ -42,22 +42,17 @@ using password_manager::metrics_util::LogLeakDialogTypeAndDismissalReason; ...@@ -42,22 +42,17 @@ using password_manager::metrics_util::LogLeakDialogTypeAndDismissalReason;
// The presenter of the feature. // The presenter of the feature.
@property(nonatomic, weak) id<PasswordBreachPresenter> presenter; @property(nonatomic, weak) id<PasswordBreachPresenter> presenter;
// Dispatcher.
@property(nonatomic, weak) id<ApplicationCommands> handler;
@end @end
@implementation PasswordBreachMediator @implementation PasswordBreachMediator
- (instancetype)initWithConsumer:(id<PasswordBreachConsumer>)consumer - (instancetype)initWithConsumer:(id<PasswordBreachConsumer>)consumer
presenter:(id<PasswordBreachPresenter>)presenter presenter:(id<PasswordBreachPresenter>)presenter
handler:(id<ApplicationCommands>)handler
URL:(const GURL&)URL URL:(const GURL&)URL
leakType:(CredentialLeakType)leakType { leakType:(CredentialLeakType)leakType {
self = [super init]; self = [super init];
if (self) { if (self) {
_presenter = presenter; _presenter = presenter;
_handler = handler;
_leakType = GetLeakDialogType(leakType); _leakType = GetLeakDialogType(leakType);
_dismissReason = LeakDialogDismissalReason::kNoDirectInteraction; _dismissReason = LeakDialogDismissalReason::kNoDirectInteraction;
...@@ -85,18 +80,9 @@ using password_manager::metrics_util::LogLeakDialogTypeAndDismissalReason; ...@@ -85,18 +80,9 @@ using password_manager::metrics_util::LogLeakDialogTypeAndDismissalReason;
- (void)confirmationAlertPrimaryAction { - (void)confirmationAlertPrimaryAction {
self.dismissReason = LeakDialogDismissalReason::kClickedCheckPasswords; self.dismissReason = LeakDialogDismissalReason::kClickedCheckPasswords;
if (base::FeatureList::IsEnabled( // Opening Password page will stop the presentation in the presenter.
password_manager::features::kPasswordCheck)) { // No need to send |stop|.
// Opening Password page will stop the presentation in the presenter. [self.presenter startPasswordCheck];
// No need to send |stop|.
[self.presenter startPasswordCheck];
} else {
// Opening a new tab already stops the presentation in the presenter.
// No need to send |stop|.
OpenNewTabCommand* newTabCommand =
[OpenNewTabCommand commandWithURLFromChrome:GetPasswordCheckupURL()];
[self.handler openURLInNewTab:newTabCommand];
}
} }
- (void)confirmationAlertSecondaryAction { - (void)confirmationAlertSecondaryAction {
......
...@@ -44,9 +44,6 @@ source_set("password") { ...@@ -44,9 +44,6 @@ source_set("password") {
source_set("password_ui") { source_set("password_ui") {
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
sources = [ sources = [
"legacy_password_details_table_view_controller.h",
"legacy_password_details_table_view_controller.mm",
"legacy_password_details_table_view_controller_delegate.h",
"password_exporter.h", "password_exporter.h",
"password_exporter.mm", "password_exporter.mm",
"password_issue.h", "password_issue.h",
...@@ -116,10 +113,7 @@ source_set("password_constants") { ...@@ -116,10 +113,7 @@ source_set("password_constants") {
source_set("test_support") { source_set("test_support") {
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
testonly = true testonly = true
sources = [ sources = [ "password_exporter_for_testing.h" ]
"legacy_password_details_table_view_controller+testing.h",
"password_exporter_for_testing.h",
]
deps = [ ":password_ui" ] deps = [ ":password_ui" ]
} }
...@@ -127,7 +121,6 @@ source_set("unit_tests") { ...@@ -127,7 +121,6 @@ source_set("unit_tests") {
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
testonly = true testonly = true
sources = [ sources = [
"legacy_password_details_table_view_controller_unittest.mm",
"password_exporter_unittest.mm", "password_exporter_unittest.mm",
"password_issues_mediator_unittest.mm", "password_issues_mediator_unittest.mm",
"password_issues_table_view_controller_unittest.mm", "password_issues_table_view_controller_unittest.mm",
......
// Copyright 2018 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_UI_SETTINGS_PASSWORD_LEGACY_PASSWORD_DETAILS_TABLE_VIEW_CONTROLLER_TESTING_H_
#define IOS_CHROME_BROWSER_UI_SETTINGS_PASSWORD_LEGACY_PASSWORD_DETAILS_TABLE_VIEW_CONTROLLER_TESTING_H_
#import "ios/chrome/browser/ui/settings/password/legacy_password_details_table_view_controller.h"
// TODO(crbug.com/943523): Refactor the PasswordTableViewController and
// PasswordsSettingsTestCase to remove this Category file.
@interface LegacyPasswordDetailsTableViewController (Testing)
// Allows to replace a |reauthenticationModule| for a fake one in integration
// tests, where the testing code cannot control the creation of the
// controller.
- (void)setReauthenticationModule:
(id<ReauthenticationProtocol>)reauthenticationModule;
@end
#endif // IOS_CHROME_BROWSER_UI_SETTINGS_PASSWORD_LEGACY_PASSWORD_DETAILS_TABLE_VIEW_CONTROLLER_TESTING_H_
// Copyright 2018 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_UI_SETTINGS_PASSWORD_LEGACY_PASSWORD_DETAILS_TABLE_VIEW_CONTROLLER_H_
#define IOS_CHROME_BROWSER_UI_SETTINGS_PASSWORD_LEGACY_PASSWORD_DETAILS_TABLE_VIEW_CONTROLLER_H_
#include "components/password_manager/core/browser/password_form_forward.h"
#import "ios/chrome/browser/ui/settings/password/legacy_password_details_table_view_controller_delegate.h"
#import "ios/chrome/browser/ui/settings/settings_root_table_view_controller.h"
@protocol ReauthenticationProtocol;
// TODO(crbug.com/1096986): Delete this view controller after Password Check
// launch.
// Displays details of a password item, including URL of the site, username and
// password in masked state as default. User can copy the URL and username,
// pass the iOS security check to see and copy the password , or delete the
// password item.
@interface LegacyPasswordDetailsTableViewController
: SettingsRootTableViewController
// The designated initializer.
- (nullable instancetype)
initWithPasswordForm:(const password_manager::PasswordForm&)passwordForm
delegate:
(nonnull
id<LegacyPasswordDetailsTableViewControllerDelegate>)
delegate
reauthenticationModule:
(nonnull id<ReauthenticationProtocol>)reauthenticationModule
NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE;
@end
#endif // IOS_CHROME_BROWSER_UI_SETTINGS_PASSWORD_LEGACY_PASSWORD_DETAILS_TABLE_VIEW_CONTROLLER_H_
// Copyright 2018 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_UI_SETTINGS_PASSWORD_LEGACY_PASSWORD_DETAILS_TABLE_VIEW_CONTROLLER_DELEGATE_H_
#define IOS_CHROME_BROWSER_UI_SETTINGS_PASSWORD_LEGACY_PASSWORD_DETAILS_TABLE_VIEW_CONTROLLER_DELEGATE_H_
#import <Foundation/Foundation.h>
#include "components/password_manager/core/browser/password_form_forward.h"
@class LegacyPasswordDetailsTableViewController;
// PasswordDetailsTableViewController uses this protocol to interact with higher
// level password controller.
@protocol LegacyPasswordDetailsTableViewControllerDelegate
- (void)passwordDetailsTableViewController:
(LegacyPasswordDetailsTableViewController*)controller
deletePassword:
(const password_manager::PasswordForm&)
passwordForm;
@end
#endif // IOS_CHROME_BROWSER_UI_SETTINGS_PASSWORD_LEGACY_PASSWORD_DETAILS_TABLE_VIEW_CONTROLLER_DELEGATE_H_
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
#include "ios/chrome/browser/sync/sync_setup_service_factory.h" #include "ios/chrome/browser/sync/sync_setup_service_factory.h"
#import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/application_commands.h"
#import "ios/chrome/browser/ui/commands/command_dispatcher.h" #import "ios/chrome/browser/ui/commands/command_dispatcher.h"
#import "ios/chrome/browser/ui/settings/password/legacy_password_details_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/password/legacy_password_details_table_view_controller_delegate.h"
#import "ios/chrome/browser/ui/settings/password/password_details/password_details_coordinator.h" #import "ios/chrome/browser/ui/settings/password/password_details/password_details_coordinator.h"
#import "ios/chrome/browser/ui/settings/password/password_details/password_details_coordinator_delegate.h" #import "ios/chrome/browser/ui/settings/password/password_details/password_details_coordinator_delegate.h"
#import "ios/chrome/browser/ui/settings/password/password_issues_coordinator.h" #import "ios/chrome/browser/ui/settings/password/password_issues_coordinator.h"
...@@ -35,7 +33,6 @@ ...@@ -35,7 +33,6 @@
#endif #endif
@interface PasswordsCoordinator () < @interface PasswordsCoordinator () <
LegacyPasswordDetailsTableViewControllerDelegate,
PasswordDetailsCoordinatorDelegate, PasswordDetailsCoordinatorDelegate,
PasswordIssuesCoordinatorDelegate, PasswordIssuesCoordinatorDelegate,
PasswordsSettingsCommands, PasswordsSettingsCommands,
...@@ -152,26 +149,15 @@ ...@@ -152,26 +149,15 @@
} }
- (void)showDetailedViewForForm:(const password_manager::PasswordForm&)form { - (void)showDetailedViewForForm:(const password_manager::PasswordForm&)form {
if (base::FeatureList::IsEnabled( DCHECK(!self.passwordDetailsCoordinator);
password_manager::features::kPasswordCheck)) { self.passwordDetailsCoordinator = [[PasswordDetailsCoordinator alloc]
DCHECK(!self.passwordDetailsCoordinator); initWithBaseNavigationController:self.baseNavigationController
self.passwordDetailsCoordinator = [[PasswordDetailsCoordinator alloc] browser:self.browser
initWithBaseNavigationController:self.baseNavigationController password:form
browser:self.browser reauthModule:self.reauthModule
password:form passwordCheckManager:[self passwordCheckManager].get()];
reauthModule:self.reauthModule self.passwordDetailsCoordinator.delegate = self;
passwordCheckManager:[self passwordCheckManager].get()]; [self.passwordDetailsCoordinator start];
self.passwordDetailsCoordinator.delegate = self;
[self.passwordDetailsCoordinator start];
} else {
LegacyPasswordDetailsTableViewController* controller =
[[LegacyPasswordDetailsTableViewController alloc]
initWithPasswordForm:form
delegate:self
reauthenticationModule:self.reauthModule];
controller.dispatcher = self.dispatcher;
[self.baseNavigationController pushViewController:controller animated:YES];
}
} }
#pragma mark - PasswordsTableViewControllerPresentationDelegate #pragma mark - PasswordsTableViewControllerPresentationDelegate
...@@ -213,15 +199,6 @@ ...@@ -213,15 +199,6 @@
[self.passwordsViewController deletePasswordForm:password]; [self.passwordsViewController deletePasswordForm:password];
} }
#pragma mark LegacyPasswordDetailsTableViewControllerDelegate
- (void)passwordDetailsTableViewController:
(LegacyPasswordDetailsTableViewController*)controller
deletePassword:
(const password_manager::PasswordForm&)form {
[self.passwordsViewController deletePasswordForm:form];
}
#pragma mark Private #pragma mark Private
- (scoped_refptr<IOSChromePasswordCheckManager>)passwordCheckManager { - (scoped_refptr<IOSChromePasswordCheckManager>)passwordCheckManager {
......
...@@ -93,13 +93,9 @@ constexpr base::TimeDelta kJustCheckedTimeThresholdInMinutes = ...@@ -93,13 +93,9 @@ constexpr base::TimeDelta kJustCheckedTimeThresholdInMinutes =
_passwordStoreObserver = _passwordStoreObserver =
std::make_unique<PasswordStoreObserverBridge>(self); std::make_unique<PasswordStoreObserverBridge>(self);
_passwordStore->AddObserver(_passwordStoreObserver.get()); _passwordStore->AddObserver(_passwordStoreObserver.get());
_passwordCheckManager = passwordCheckManager;
if (base::FeatureList::IsEnabled( _passwordCheckObserver = std::make_unique<PasswordCheckObserverBridge>(
password_manager::features::kPasswordCheck)) { self, _passwordCheckManager.get());
_passwordCheckManager = passwordCheckManager;
_passwordCheckObserver = std::make_unique<PasswordCheckObserverBridge>(
self, _passwordCheckManager.get());
}
} }
return self; return self;
} }
...@@ -108,6 +104,9 @@ constexpr base::TimeDelta kJustCheckedTimeThresholdInMinutes = ...@@ -108,6 +104,9 @@ constexpr base::TimeDelta kJustCheckedTimeThresholdInMinutes =
if (_passwordStoreObserver) { if (_passwordStoreObserver) {
_passwordStore->RemoveObserver(_passwordStoreObserver.get()); _passwordStore->RemoveObserver(_passwordStoreObserver.get());
} }
if (_passwordCheckObserver) {
_passwordCheckManager->RemoveObserver(_passwordCheckObserver.get());
}
} }
- (void)setConsumer:(id<PasswordsConsumer>)consumer { - (void)setConsumer:(id<PasswordsConsumer>)consumer {
...@@ -116,15 +115,12 @@ constexpr base::TimeDelta kJustCheckedTimeThresholdInMinutes = ...@@ -116,15 +115,12 @@ constexpr base::TimeDelta kJustCheckedTimeThresholdInMinutes =
_consumer = consumer; _consumer = consumer;
[self loginsDidChange]; [self loginsDidChange];
if (base::FeatureList::IsEnabled( _currentState = _passwordCheckManager->GetPasswordCheckState();
password_manager::features::kPasswordCheck)) { [self.consumer setPasswordCheckUIState:
_currentState = _passwordCheckManager->GetPasswordCheckState(); [self computePasswordCheckUIStateWith:_currentState]
[self.consumer setPasswordCheckUIState: compromisedPasswordsCount:_passwordCheckManager
[self computePasswordCheckUIStateWith:_currentState] ->GetCompromisedCredentials()
compromisedPasswordsCount:_passwordCheckManager .size()];
->GetCompromisedCredentials()
.size()];
}
} }
#pragma mark - PasswordsTableViewControllerDelegate #pragma mark - PasswordsTableViewControllerDelegate
......
...@@ -87,8 +87,6 @@ class PasswordsMediatorTest : public BlockCleanupTest { ...@@ -87,8 +87,6 @@ class PasswordsMediatorTest : public BlockCleanupTest {
protected: protected:
void SetUp() override { void SetUp() override {
BlockCleanupTest::SetUp(); BlockCleanupTest::SetUp();
scoped_feature_list_.InitAndEnableFeature(
password_manager::features::kPasswordCheck);
TestChromeBrowserState::Builder builder; TestChromeBrowserState::Builder builder;
builder.AddTestingFactory( builder.AddTestingFactory(
...@@ -134,7 +132,6 @@ class PasswordsMediatorTest : public BlockCleanupTest { ...@@ -134,7 +132,6 @@ class PasswordsMediatorTest : public BlockCleanupTest {
scoped_refptr<IOSChromePasswordCheckManager> password_check_; scoped_refptr<IOSChromePasswordCheckManager> password_check_;
FakePasswordsConsumer* consumer_; FakePasswordsConsumer* consumer_;
PasswordsMediator* mediator_; PasswordsMediator* mediator_;
base::test::ScopedFeatureList scoped_feature_list_;
}; };
TEST_F(PasswordsMediatorTest, ElapsedTimeSinceLastCheck) { TEST_F(PasswordsMediatorTest, ElapsedTimeSinceLastCheck) {
......
...@@ -312,12 +312,9 @@ void CopyPasswordDetailWithID(int detail_id) { ...@@ -312,12 +312,9 @@ void CopyPasswordDetailWithID(int detail_id) {
- (AppLaunchConfiguration)appConfigurationForTestCase { - (AppLaunchConfiguration)appConfigurationForTestCase {
AppLaunchConfiguration config; AppLaunchConfiguration config;
// Password Check Feature is enabled for all tests. This is done because it // Password Editing Feature is enabled by test name. This is done because it
// is inefficient to use ensureAppLaunchedWithConfiguration for each test. // is inefficient to use ensureAppLaunchedWithConfiguration for each test.
// This should be removed once test config is modified. // This should be removed once test config is modified.
// TODO(crbug.com/1075494): Remove this once feature is launched.
config.features_enabled.push_back(password_manager::features::kPasswordCheck);
if ([self isRunningTest:@selector(testEditUsername)] || if ([self isRunningTest:@selector(testEditUsername)] ||
[self isRunningTest:@selector(testEditUsernameFails)]) { [self isRunningTest:@selector(testEditUsernameFails)]) {
config.features_enabled.push_back( config.features_enabled.push_back(
......
...@@ -414,30 +414,27 @@ std::vector<std::unique_ptr<password_manager::PasswordForm>> CopyOf( ...@@ -414,30 +414,27 @@ std::vector<std::unique_ptr<password_manager::PasswordForm>> CopyOf(
forSectionWithIdentifier:SectionIdentifierSavePasswordsSwitch]; forSectionWithIdentifier:SectionIdentifierSavePasswordsSwitch];
} }
if (base::FeatureList::IsEnabled( // Password check.
password_manager::features::kPasswordCheck)) { [model addSectionWithIdentifier:SectionIdentifierPasswordCheck];
// Password check. if (!_passwordProblemsItem) {
[model addSectionWithIdentifier:SectionIdentifierPasswordCheck]; _passwordProblemsItem = [self passwordProblemsItem];
if (!_passwordProblemsItem) { }
_passwordProblemsItem = [self passwordProblemsItem];
}
[self updatePasswordCheckStatusLabelWithState:_passwordCheckState]; [self updatePasswordCheckStatusLabelWithState:_passwordCheckState];
[model addItem:_passwordProblemsItem [model addItem:_passwordProblemsItem
toSectionWithIdentifier:SectionIdentifierPasswordCheck]; toSectionWithIdentifier:SectionIdentifierPasswordCheck];
if (!_checkForProblemsItem) { if (!_checkForProblemsItem) {
_checkForProblemsItem = [self checkForProblemsItem]; _checkForProblemsItem = [self checkForProblemsItem];
} }
[self updatePasswordCheckButtonWithState:_passwordCheckState]; [self updatePasswordCheckButtonWithState:_passwordCheckState];
[model addItem:_checkForProblemsItem [model addItem:_checkForProblemsItem
toSectionWithIdentifier:SectionIdentifierPasswordCheck]; toSectionWithIdentifier:SectionIdentifierPasswordCheck];
[self updateLastCheckTimestampWithState:_passwordCheckState [self updateLastCheckTimestampWithState:_passwordCheckState
fromState:_passwordCheckState fromState:_passwordCheckState
update:NO]; update:NO];
}
// Saved passwords. // Saved passwords.
if (!_savedForms.empty()) { if (!_savedForms.empty()) {
...@@ -724,13 +721,11 @@ std::vector<std::unique_ptr<password_manager::PasswordForm>> CopyOf( ...@@ -724,13 +721,11 @@ std::vector<std::unique_ptr<password_manager::PasswordForm>> CopyOf(
- (void)setPasswordsForms: - (void)setPasswordsForms:
(std::vector<std::unique_ptr<password_manager::PasswordForm>>)results { (std::vector<std::unique_ptr<password_manager::PasswordForm>>)results {
if (base::FeatureList::IsEnabled( _blockedForms.clear();
password_manager::features::kPasswordCheck)) { _savedForms.clear();
_blockedForms.clear(); _savedPasswordDuplicates.clear();
_savedForms.clear(); _blockedPasswordDuplicates.clear();
_savedPasswordDuplicates.clear();
_blockedPasswordDuplicates.clear();
}
_didReceiveSavedForms = YES; _didReceiveSavedForms = YES;
[self hideLoadingSpinnerBackground]; [self hideLoadingSpinnerBackground];
if (results.empty()) { if (results.empty()) {
...@@ -799,11 +794,8 @@ std::vector<std::unique_ptr<password_manager::PasswordForm>> CopyOf( ...@@ -799,11 +794,8 @@ std::vector<std::unique_ptr<password_manager::PasswordForm>> CopyOf(
// Remove save passwords switch section and password check section. // Remove save passwords switch section and password check section.
[self [self
performBatchTableViewUpdates:^{ performBatchTableViewUpdates:^{
if (base::FeatureList::IsEnabled( [self clearSectionWithIdentifier:SectionIdentifierPasswordCheck
password_manager::features::kPasswordCheck)) { withRowAnimation:UITableViewRowAnimationTop];
[self clearSectionWithIdentifier:SectionIdentifierPasswordCheck
withRowAnimation:UITableViewRowAnimationTop];
}
[self clearSectionWithIdentifier:SectionIdentifierSavePasswordsSwitch [self clearSectionWithIdentifier:SectionIdentifierSavePasswordsSwitch
withRowAnimation:UITableViewRowAnimationTop]; withRowAnimation:UITableViewRowAnimationTop];
...@@ -837,25 +829,21 @@ std::vector<std::unique_ptr<password_manager::PasswordForm>> CopyOf( ...@@ -837,25 +829,21 @@ std::vector<std::unique_ptr<password_manager::PasswordForm>> CopyOf(
arrayWithObjects:[NSIndexPath indexPathForRow:0 arrayWithObjects:[NSIndexPath indexPathForRow:0
inSection:switchSection], inSection:switchSection],
nil]; nil];
[model insertSectionWithIdentifier:SectionIdentifierPasswordCheck
atIndex:1];
NSInteger checkSection =
[model sectionForSectionIdentifier:SectionIdentifierPasswordCheck];
if (base::FeatureList::IsEnabled( [self.tableView insertSections:[NSIndexSet indexSetWithIndex:1]
password_manager::features::kPasswordCheck)) { withRowAnimation:UITableViewRowAnimationTop];
[model insertSectionWithIdentifier:SectionIdentifierPasswordCheck [model addItem:_passwordProblemsItem
atIndex:1]; toSectionWithIdentifier:SectionIdentifierPasswordCheck];
NSInteger checkSection = [model [model addItem:_checkForProblemsItem
sectionForSectionIdentifier:SectionIdentifierPasswordCheck]; toSectionWithIdentifier:SectionIdentifierPasswordCheck];
[rowsIndexPaths addObject:[NSIndexPath indexPathForRow:0
[self.tableView insertSections:[NSIndexSet indexSetWithIndex:1] inSection:checkSection]];
withRowAnimation:UITableViewRowAnimationTop]; [rowsIndexPaths addObject:[NSIndexPath indexPathForRow:1
[model addItem:_passwordProblemsItem inSection:checkSection]];
toSectionWithIdentifier:SectionIdentifierPasswordCheck];
[model addItem:_checkForProblemsItem
toSectionWithIdentifier:SectionIdentifierPasswordCheck];
[rowsIndexPaths addObject:[NSIndexPath indexPathForRow:0
inSection:checkSection]];
[rowsIndexPaths addObject:[NSIndexPath indexPathForRow:1
inSection:checkSection]];
}
[self.tableView insertRowsAtIndexPaths:rowsIndexPaths [self.tableView insertRowsAtIndexPaths:rowsIndexPaths
withRowAnimation:UITableViewRowAnimationTop]; withRowAnimation:UITableViewRowAnimationTop];
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "ios/chrome/test/app/password_test_util.h" #include "ios/chrome/test/app/password_test_util.h"
#include "base/mac/foundation_util.h" #include "base/mac/foundation_util.h"
#import "ios/chrome/browser/ui/settings/password/legacy_password_details_table_view_controller+testing.h"
#import "ios/chrome/browser/ui/settings/password/password_details/password_details_table_view_controller.h" #import "ios/chrome/browser/ui/settings/password/password_details/password_details_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/password/passwords_table_view_controller.h" #import "ios/chrome/browser/ui/settings/password/passwords_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/settings_navigation_controller.h" #import "ios/chrome/browser/ui/settings/settings_navigation_controller.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment