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 { ...@@ -130,7 +130,6 @@ enum AuthenticationState {
} // namespace } // namespace
@interface ChromeSigninViewController () < @interface ChromeSigninViewController () <
ChromeIdentityInteractionManagerDelegate,
ChromeIdentityServiceObserver, ChromeIdentityServiceObserver,
MDCActivityIndicatorDelegate, MDCActivityIndicatorDelegate,
UIAdaptivePresentationControllerDelegate, UIAdaptivePresentationControllerDelegate,
...@@ -569,7 +568,7 @@ enum AuthenticationState { ...@@ -569,7 +568,7 @@ enum AuthenticationState {
_interactionManager = _interactionManager =
ios::GetChromeBrowserProvider() ios::GetChromeBrowserProvider()
->GetChromeIdentityService() ->GetChromeIdentityService()
->CreateChromeIdentityInteractionManager(self.browserState, self); ->CreateChromeIdentityInteractionManager(self.browserState);
__weak ChromeSigninViewController* weakSelf = self; __weak ChromeSigninViewController* weakSelf = self;
SigninCompletionCallback completion = SigninCompletionCallback completion =
^(ChromeIdentity* identity, NSError* error) { ^(ChromeIdentity* identity, NSError* error) {
......
...@@ -23,9 +23,7 @@ ...@@ -23,9 +23,7 @@
using signin_metrics::AccessPoint; using signin_metrics::AccessPoint;
using signin_metrics::PromoAction; using signin_metrics::PromoAction;
@interface AddAccountSigninCoordinator () < @interface AddAccountSigninCoordinator () <AddAccountSigninManagerDelegate>
AddAccountSigninManagerDelegate,
ChromeIdentityInteractionManagerDelegate>
// Coordinator to display modal alerts to the user. // Coordinator to display modal alerts to the user.
@property(nonatomic, strong) AlertCoordinator* alertCoordinator; @property(nonatomic, strong) AlertCoordinator* alertCoordinator;
...@@ -112,7 +110,7 @@ using signin_metrics::PromoAction; ...@@ -112,7 +110,7 @@ using signin_metrics::PromoAction;
ios::GetChromeBrowserProvider() ios::GetChromeBrowserProvider()
->GetChromeIdentityService() ->GetChromeIdentityService()
->CreateChromeIdentityInteractionManager( ->CreateChromeIdentityInteractionManager(
self.browser->GetBrowserState(), self); self.browser->GetBrowserState());
signin::IdentityManager* identityManager = signin::IdentityManager* identityManager =
IdentityManagerFactory::GetForBrowserState( IdentityManagerFactory::GetForBrowserState(
...@@ -136,25 +134,6 @@ using signin_metrics::PromoAction; ...@@ -136,25 +134,6 @@ using signin_metrics::PromoAction;
DCHECK(!self.userSigninCoordinator); 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 #pragma mark - AddAccountSigninManagerDelegate
- (void)addAccountSigninManagerFailedWithError:(NSError*)error { - (void)addAccountSigninManagerFailedWithError:(NSError*)error {
......
...@@ -29,31 +29,6 @@ const char kTestGaiaID[] = "fooID"; ...@@ -29,31 +29,6 @@ const char kTestGaiaID[] = "fooID";
const char kTestEmail[] = "foo@gmail.com"; const char kTestEmail[] = "foo@gmail.com";
} // namespace } // 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 { class AddAccountSigninManagerTest : public PlatformTest {
public: public:
AddAccountSigninManagerTest() AddAccountSigninManagerTest()
...@@ -61,16 +36,13 @@ class AddAccountSigninManagerTest : public PlatformTest { ...@@ -61,16 +36,13 @@ class AddAccountSigninManagerTest : public PlatformTest {
base_view_controller_([[UIViewController alloc] init]), base_view_controller_([[UIViewController alloc] init]),
identity_service_( identity_service_(
ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()) { ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()) {
identity_interaction_manager_delegate_ =
[[FakeChromeIdentityInteractionManagerDelegate alloc] init];
identity_interaction_manager_ = GetIdentityInteractionManager(); identity_interaction_manager_ = GetIdentityInteractionManager();
} }
FakeChromeIdentityInteractionManager* GetIdentityInteractionManager() { FakeChromeIdentityInteractionManager* GetIdentityInteractionManager() {
FakeChromeIdentityInteractionManager* identity_interaction_manager = FakeChromeIdentityInteractionManager* identity_interaction_manager =
ios::FakeChromeIdentityService::GetInstanceFromChromeProvider() ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()
->CreateFakeChromeIdentityInteractionManager( ->CreateFakeChromeIdentityInteractionManager(browser_state_.get());
browser_state_.get(), identity_interaction_manager_delegate_);
fake_identity_ = [FakeChromeIdentity fake_identity_ = [FakeChromeIdentity
identityWithEmail:[NSString stringWithUTF8String:kTestEmail] identityWithEmail:[NSString stringWithUTF8String:kTestEmail]
gaiaID:[NSString stringWithUTF8String:kTestGaiaID] gaiaID:[NSString stringWithUTF8String:kTestGaiaID]
...@@ -122,8 +94,6 @@ class AddAccountSigninManagerTest : public PlatformTest { ...@@ -122,8 +94,6 @@ class AddAccountSigninManagerTest : public PlatformTest {
ios::FakeChromeIdentityService* identity_service_ = nullptr; ios::FakeChromeIdentityService* identity_service_ = nullptr;
FakeChromeIdentityInteractionManager* identity_interaction_manager_ = nil; FakeChromeIdentityInteractionManager* identity_interaction_manager_ = nil;
id<ChromeIdentityInteractionManagerDelegate>
identity_interaction_manager_delegate_ = nil;
FakeChromeIdentity* fake_identity_ = nil; FakeChromeIdentity* fake_identity_ = nil;
}; };
......
...@@ -33,24 +33,6 @@ typedef void (^SigninCompletionCallback)(ChromeIdentity* identity, ...@@ -33,24 +33,6 @@ typedef void (^SigninCompletionCallback)(ChromeIdentity* identity,
@property(nonatomic, weak) id<ChromeIdentityInteractionManagerDelegate> @property(nonatomic, weak) id<ChromeIdentityInteractionManagerDelegate>
delegate; 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 // Starts the add account operation for a user. Presents user with the screen to
// enter credentials. // enter credentials.
// Note: Calling this method will fail and the completion will be called with a // Note: Calling this method will fail and the completion will be called with a
...@@ -109,7 +91,6 @@ typedef void (^SigninCompletionCallback)(ChromeIdentity* identity, ...@@ -109,7 +91,6 @@ typedef void (^SigninCompletionCallback)(ChromeIdentity* identity,
- (void)interactionManager:(ChromeIdentityInteractionManager*)interactionManager - (void)interactionManager:(ChromeIdentityInteractionManager*)interactionManager
dismissViewControllerAnimated:(BOOL)animated dismissViewControllerAnimated:(BOOL)animated
completion:(ProceduralBlock)completion; completion:(ProceduralBlock)completion;
@end @end
#endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_CHROME_IDENTITY_INTERACTION_MANAGER_H_ #endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_SIGNIN_CHROME_IDENTITY_INTERACTION_MANAGER_H_
...@@ -15,24 +15,6 @@ ...@@ -15,24 +15,6 @@
@implementation ChromeIdentityInteractionManager @implementation ChromeIdentityInteractionManager
@synthesize delegate = _delegate; @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 - (void)addAccountWithPresentingViewController:(UIViewController*)viewController
completion: completion:
(SigninCompletionCallback)completion { (SigninCompletionCallback)completion {
......
...@@ -132,13 +132,19 @@ class ChromeIdentityService { ...@@ -132,13 +132,19 @@ class ChromeIdentityService {
UIViewController* view_controller, UIViewController* view_controller,
BOOL animated); BOOL animated);
// Returns a new ChromeIdentityInteractionManager with |delegate| as its // Deprecated. Please use:
// delegate. // CreateChromeIdentityInteractionManager(ChromeBrowserState*). Returns a new
// ChromeIdentityInteractionManager with |delegate| as its delegate.
virtual ChromeIdentityInteractionManager* virtual ChromeIdentityInteractionManager*
CreateChromeIdentityInteractionManager( CreateChromeIdentityInteractionManager(
ChromeBrowserState* browser_state, ChromeBrowserState* browser_state,
id<ChromeIdentityInteractionManagerDelegate> delegate) const; 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 // Returns YES if |identity| is valid and if the service has it in its list of
// identitites. // identitites.
virtual bool IsValidIdentity(ChromeIdentity* identity) const; virtual bool IsValidIdentity(ChromeIdentity* identity) const;
......
...@@ -53,6 +53,12 @@ ChromeIdentityService::CreateChromeIdentityInteractionManager( ...@@ -53,6 +53,12 @@ ChromeIdentityService::CreateChromeIdentityInteractionManager(
return nil; return nil;
} }
ChromeIdentityInteractionManager*
ChromeIdentityService::CreateChromeIdentityInteractionManager(
ChromeBrowserState* browser_state) const {
return CreateChromeIdentityInteractionManager(browser_state, nil);
}
bool ChromeIdentityService::IsValidIdentity(ChromeIdentity* identity) const { bool ChromeIdentityService::IsValidIdentity(ChromeIdentity* identity) const {
return false; return false;
} }
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
@interface FakeChromeIdentityInteractionManager () { @interface FakeChromeIdentityInteractionManager () {
SigninCompletionCallback _completionCallback; SigninCompletionCallback _completionCallback;
UIViewController* _viewController; UIViewController* _viewController;
BOOL _isCanceling;
} }
@end @end
...@@ -98,33 +97,6 @@ ...@@ -98,33 +97,6 @@
@synthesize fakeIdentity = _fakeIdentity; @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 - (void)addAccountWithPresentingViewController:(UIViewController*)viewController
completion: completion:
(SigninCompletionCallback)completion { (SigninCompletionCallback)completion {
...@@ -170,15 +142,15 @@ ...@@ -170,15 +142,15 @@
- (void)dismissAndRunCompletionCallbackWithError:(NSError*)error - (void)dismissAndRunCompletionCallbackWithError:(NSError*)error
animated:(BOOL)animated { animated:(BOOL)animated {
if (!_viewController) { ProceduralBlock dismissCompletion = ^{
[self runCompletionCallbackWithError:error]; [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 { - (void)runCompletionCallbackWithError:(NSError*)error {
......
...@@ -32,12 +32,10 @@ class FakeChromeIdentityService : public ChromeIdentityService { ...@@ -32,12 +32,10 @@ class FakeChromeIdentityService : public ChromeIdentityService {
UIViewController* viewController, UIViewController* viewController,
BOOL animated) override; BOOL animated) override;
ChromeIdentityInteractionManager* CreateChromeIdentityInteractionManager( ChromeIdentityInteractionManager* CreateChromeIdentityInteractionManager(
ChromeBrowserState* browser_state, ChromeBrowserState* browser_state) const override;
id<ChromeIdentityInteractionManagerDelegate> delegate) const override;
FakeChromeIdentityInteractionManager* FakeChromeIdentityInteractionManager*
CreateFakeChromeIdentityInteractionManager( CreateFakeChromeIdentityInteractionManager(
ChromeBrowserState* browser_state, ChromeBrowserState* browser_state) const;
id<ChromeIdentityInteractionManagerDelegate> delegate) const;
bool IsValidIdentity(ChromeIdentity* identity) const override; bool IsValidIdentity(ChromeIdentity* identity) const override;
ChromeIdentity* GetIdentityWithGaiaID( ChromeIdentity* GetIdentityWithGaiaID(
......
...@@ -156,19 +156,14 @@ FakeChromeIdentityService::PresentAccountDetailsController( ...@@ -156,19 +156,14 @@ FakeChromeIdentityService::PresentAccountDetailsController(
ChromeIdentityInteractionManager* ChromeIdentityInteractionManager*
FakeChromeIdentityService::CreateChromeIdentityInteractionManager( FakeChromeIdentityService::CreateChromeIdentityInteractionManager(
ChromeBrowserState* browser_state, ChromeBrowserState* browser_state) const {
id<ChromeIdentityInteractionManagerDelegate> delegate) const { return CreateFakeChromeIdentityInteractionManager(browser_state);
return CreateFakeChromeIdentityInteractionManager(browser_state, delegate);
} }
FakeChromeIdentityInteractionManager* FakeChromeIdentityInteractionManager*
FakeChromeIdentityService::CreateFakeChromeIdentityInteractionManager( FakeChromeIdentityService::CreateFakeChromeIdentityInteractionManager(
ChromeBrowserState* browser_state, ChromeBrowserState* browser_state) const {
id<ChromeIdentityInteractionManagerDelegate> delegate) const { return [[FakeChromeIdentityInteractionManager alloc] init];
FakeChromeIdentityInteractionManager* manager =
[[FakeChromeIdentityInteractionManager alloc] init];
manager.delegate = delegate;
return manager;
} }
bool FakeChromeIdentityService::IsValidIdentity( 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