Commit 053f6124 authored by Nohemi Fernandez's avatar Nohemi Fernandez Committed by Commit Bot

[iOS] Remove unused ChromeIdentityInteractionManager APIs.

This patch removes the old, unused APIs for adding an account to Chrome.

Bug: 1078815
Change-Id: I0ec5d29af7566d8287090ee83b8a67d4a1abb9ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2226809
Commit-Queue: Nohemi Fernandez <fernandex@chromium.org>
Reviewed-by: default avatarJérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781345}
parent eecf300c
......@@ -130,7 +130,6 @@ enum AuthenticationState {
} // namespace
@interface ChromeSigninViewController () <
ChromeIdentityInteractionManagerDelegate,
ChromeIdentityServiceObserver,
MDCActivityIndicatorDelegate,
UIAdaptivePresentationControllerDelegate,
......@@ -569,7 +568,7 @@ enum AuthenticationState {
_interactionManager =
ios::GetChromeBrowserProvider()
->GetChromeIdentityService()
->CreateChromeIdentityInteractionManager(self.browserState, self);
->CreateChromeIdentityInteractionManager(self.browserState);
__weak ChromeSigninViewController* weakSelf = self;
SigninCompletionCallback completion =
^(ChromeIdentity* identity, NSError* error) {
......
......@@ -23,9 +23,7 @@
using signin_metrics::AccessPoint;
using signin_metrics::PromoAction;
@interface AddAccountSigninCoordinator () <
AddAccountSigninManagerDelegate,
ChromeIdentityInteractionManagerDelegate>
@interface AddAccountSigninCoordinator () <AddAccountSigninManagerDelegate>
// Coordinator to display modal alerts to the user.
@property(nonatomic, strong) AlertCoordinator* alertCoordinator;
......@@ -112,7 +110,7 @@ using signin_metrics::PromoAction;
ios::GetChromeBrowserProvider()
->GetChromeIdentityService()
->CreateChromeIdentityInteractionManager(
self.browser->GetBrowserState(), self);
self.browser->GetBrowserState());
signin::IdentityManager* identityManager =
IdentityManagerFactory::GetForBrowserState(
......@@ -136,25 +134,6 @@ using signin_metrics::PromoAction;
DCHECK(!self.userSigninCoordinator);
}
#pragma mark - ChromeIdentityInteractionManagerDelegate
- (void)interactionManager:(ChromeIdentityInteractionManager*)interactionManager
dismissViewControllerAnimated:(BOOL)animated
completion:(ProceduralBlock)completion {
[self.baseViewController.presentedViewController
dismissViewControllerAnimated:animated
completion:completion];
}
- (void)interactionManager:(ChromeIdentityInteractionManager*)interactionManager
presentViewController:(UIViewController*)viewController
animated:(BOOL)animated
completion:(ProceduralBlock)completion {
[self.baseViewController presentViewController:viewController
animated:animated
completion:completion];
}
#pragma mark - AddAccountSigninManagerDelegate
- (void)addAccountSigninManagerFailedWithError:(NSError*)error {
......
......@@ -29,31 +29,6 @@ const char kTestGaiaID[] = "fooID";
const char kTestEmail[] = "foo@gmail.com";
} // namespace
// Fake implementation of ChromeIdentityInteractionManagerDelegate that calls
// completion callback.
@interface FakeChromeIdentityInteractionManagerDelegate
: NSObject <ChromeIdentityInteractionManagerDelegate>
@end
@implementation FakeChromeIdentityInteractionManagerDelegate
- (void)interactionManager:(ChromeIdentityInteractionManager*)interactionManager
presentViewController:(UIViewController*)viewController
animated:(BOOL)animated
completion:(ProceduralBlock)completion {
if (completion) {
completion();
}
}
- (void)interactionManager:(ChromeIdentityInteractionManager*)interactionManager
dismissViewControllerAnimated:(BOOL)animated
completion:(ProceduralBlock)completion {
if (completion) {
completion();
}
}
@end
class AddAccountSigninManagerTest : public PlatformTest {
public:
AddAccountSigninManagerTest()
......@@ -61,16 +36,13 @@ class AddAccountSigninManagerTest : public PlatformTest {
base_view_controller_([[UIViewController alloc] init]),
identity_service_(
ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()) {
identity_interaction_manager_delegate_ =
[[FakeChromeIdentityInteractionManagerDelegate alloc] init];
identity_interaction_manager_ = GetIdentityInteractionManager();
}
FakeChromeIdentityInteractionManager* GetIdentityInteractionManager() {
FakeChromeIdentityInteractionManager* identity_interaction_manager =
ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()
->CreateFakeChromeIdentityInteractionManager(
browser_state_.get(), identity_interaction_manager_delegate_);
->CreateFakeChromeIdentityInteractionManager(browser_state_.get());
fake_identity_ = [FakeChromeIdentity
identityWithEmail:[NSString stringWithUTF8String:kTestEmail]
gaiaID:[NSString stringWithUTF8String:kTestGaiaID]
......@@ -122,8 +94,6 @@ class AddAccountSigninManagerTest : public PlatformTest {
ios::FakeChromeIdentityService* identity_service_ = nullptr;
FakeChromeIdentityInteractionManager* identity_interaction_manager_ = nil;
id<ChromeIdentityInteractionManagerDelegate>
identity_interaction_manager_delegate_ = nil;
FakeChromeIdentity* fake_identity_ = nil;
};
......
......@@ -33,24 +33,6 @@ typedef void (^SigninCompletionCallback)(ChromeIdentity* identity,
@property(nonatomic, weak) id<ChromeIdentityInteractionManagerDelegate>
delegate;
// Whether the manager is currently being canceled. Delegates may inquire if the
// dismissal is due to sign-in being canceled.
@property(nonatomic, readonly) BOOL isCanceling;
// Deprecated.
// Use |addAccountWithPresentingViewController:completion|.
- (void)addAccountWithCompletion:(SigninCompletionCallback)completion;
// Deprecated.
// Use |addAccountWithPresentingViewController:userEmail:completion|.
- (void)reauthenticateUserWithID:(NSString*)userID
email:(NSString*)userEmail
completion:(SigninCompletionCallback)completion;
// Deprecated.
// Use |cancelAddAccountWithAnimation:completion|.
- (void)cancelAndDismissAnimated:(BOOL)animated;
// Starts the add account operation for a user. Presents user with the screen to
// enter credentials.
// Note: Calling this method will fail and the completion will be called with a
......@@ -109,7 +91,6 @@ typedef void (^SigninCompletionCallback)(ChromeIdentity* identity,
- (void)interactionManager:(ChromeIdentityInteractionManager*)interactionManager
dismissViewControllerAnimated:(BOOL)animated
completion:(ProceduralBlock)completion;
@end
#endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_CHROME_IDENTITY_INTERACTION_MANAGER_H_
......@@ -15,24 +15,6 @@
@implementation ChromeIdentityInteractionManager
@synthesize delegate = _delegate;
- (BOOL)isCanceling {
return NO;
}
- (void)addAccountWithCompletion:(SigninCompletionCallback)completion {
NOTREACHED() << "Subclasses must override this";
}
- (void)reauthenticateUserWithID:(NSString*)userID
email:(NSString*)userEmail
completion:(SigninCompletionCallback)completion {
NOTREACHED() << "Subclasses must override this";
}
- (void)cancelAndDismissAnimated:(BOOL)animated {
NOTREACHED() << "Subclasses must override this";
}
- (void)addAccountWithPresentingViewController:(UIViewController*)viewController
completion:
(SigninCompletionCallback)completion {
......
......@@ -132,13 +132,19 @@ class ChromeIdentityService {
UIViewController* view_controller,
BOOL animated);
// Returns a new ChromeIdentityInteractionManager with |delegate| as its
// delegate.
// Deprecated. Please use:
// CreateChromeIdentityInteractionManager(ChromeBrowserState*). Returns a new
// ChromeIdentityInteractionManager with |delegate| as its delegate.
virtual ChromeIdentityInteractionManager*
CreateChromeIdentityInteractionManager(
ChromeBrowserState* browser_state,
id<ChromeIdentityInteractionManagerDelegate> delegate) const;
// Returns a new ChromeIdentityInteractionManager.
virtual ChromeIdentityInteractionManager*
CreateChromeIdentityInteractionManager(
ChromeBrowserState* browser_state) const;
// Returns YES if |identity| is valid and if the service has it in its list of
// identitites.
virtual bool IsValidIdentity(ChromeIdentity* identity) const;
......
......@@ -53,6 +53,12 @@ ChromeIdentityService::CreateChromeIdentityInteractionManager(
return nil;
}
ChromeIdentityInteractionManager*
ChromeIdentityService::CreateChromeIdentityInteractionManager(
ChromeBrowserState* browser_state) const {
return CreateChromeIdentityInteractionManager(browser_state, nil);
}
bool ChromeIdentityService::IsValidIdentity(ChromeIdentity* identity) const {
return false;
}
......
......@@ -24,7 +24,6 @@
@interface FakeChromeIdentityInteractionManager () {
SigninCompletionCallback _completionCallback;
UIViewController* _viewController;
BOOL _isCanceling;
}
@end
......@@ -98,33 +97,6 @@
@synthesize fakeIdentity = _fakeIdentity;
- (BOOL)isCanceling {
return _isCanceling;
}
- (void)addAccountWithCompletion:(SigninCompletionCallback)completion {
_completionCallback = completion;
_viewController =
[[FakeAddAccountViewController alloc] initWithInteractionManager:self];
[self.delegate interactionManager:self
presentViewController:_viewController
animated:YES
completion:nil];
}
- (void)reauthenticateUserWithID:(NSString*)userID
email:(NSString*)userEmail
completion:(SigninCompletionCallback)completion {
[self addAccountWithCompletion:completion];
}
- (void)cancelAndDismissAnimated:(BOOL)animated {
_isCanceling = YES;
[self dismissAndRunCompletionCallbackWithError:[self canceledError]
animated:animated];
_isCanceling = NO;
}
- (void)addAccountWithPresentingViewController:(UIViewController*)viewController
completion:
(SigninCompletionCallback)completion {
......@@ -170,15 +142,15 @@
- (void)dismissAndRunCompletionCallbackWithError:(NSError*)error
animated:(BOOL)animated {
if (!_viewController) {
ProceduralBlock dismissCompletion = ^{
[self runCompletionCallbackWithError:error];
return;
};
if (_viewController) {
[_viewController dismissViewControllerAnimated:animated
completion:dismissCompletion];
} else {
dismissCompletion();
}
[self.delegate interactionManager:self
dismissViewControllerAnimated:animated
completion:^{
[self runCompletionCallbackWithError:error];
}];
}
- (void)runCompletionCallbackWithError:(NSError*)error {
......
......@@ -32,12 +32,10 @@ class FakeChromeIdentityService : public ChromeIdentityService {
UIViewController* viewController,
BOOL animated) override;
ChromeIdentityInteractionManager* CreateChromeIdentityInteractionManager(
ChromeBrowserState* browser_state,
id<ChromeIdentityInteractionManagerDelegate> delegate) const override;
ChromeBrowserState* browser_state) const override;
FakeChromeIdentityInteractionManager*
CreateFakeChromeIdentityInteractionManager(
ChromeBrowserState* browser_state,
id<ChromeIdentityInteractionManagerDelegate> delegate) const;
ChromeBrowserState* browser_state) const;
bool IsValidIdentity(ChromeIdentity* identity) const override;
ChromeIdentity* GetIdentityWithGaiaID(
......
......@@ -156,19 +156,14 @@ FakeChromeIdentityService::PresentAccountDetailsController(
ChromeIdentityInteractionManager*
FakeChromeIdentityService::CreateChromeIdentityInteractionManager(
ChromeBrowserState* browser_state,
id<ChromeIdentityInteractionManagerDelegate> delegate) const {
return CreateFakeChromeIdentityInteractionManager(browser_state, delegate);
ChromeBrowserState* browser_state) const {
return CreateFakeChromeIdentityInteractionManager(browser_state);
}
FakeChromeIdentityInteractionManager*
FakeChromeIdentityService::CreateFakeChromeIdentityInteractionManager(
ChromeBrowserState* browser_state,
id<ChromeIdentityInteractionManagerDelegate> delegate) const {
FakeChromeIdentityInteractionManager* manager =
[[FakeChromeIdentityInteractionManager alloc] init];
manager.delegate = delegate;
return manager;
ChromeBrowserState* browser_state) const {
return [[FakeChromeIdentityInteractionManager alloc] init];
}
bool FakeChromeIdentityService::IsValidIdentity(
......
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