OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_UI_AUTHENTICATION_AUTHENTICATION_FLOW_PERFORMER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_AUTHENTICATION_AUTHENTICATION_FLOW_PERFORMER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #import <UIKit/UIKit.h> |
| 11 |
| 12 #import "base/ios/block_types.h" |
| 13 #import "ios/chrome/browser/ui/authentication/authentication_flow_performer_dele
gate.h" |
| 14 |
| 15 @class ChromeIdentity; |
| 16 |
| 17 namespace ios { |
| 18 class ChromeBrowserState; |
| 19 } // namespace ios |
| 20 |
| 21 // Performs the sign-in steps and user interactions as part of the sign-in flow. |
| 22 @interface AuthenticationFlowPerformer : NSObject |
| 23 |
| 24 // Initializes a new AuthenticationFlowPerformer. |delegate| will be notified |
| 25 // when each step completes. |
| 26 - (instancetype)initWithDelegate: |
| 27 (id<AuthenticationFlowPerformerDelegate>)delegate NS_DESIGNATED_INITIALIZER; |
| 28 |
| 29 - (instancetype)init NS_UNAVAILABLE; |
| 30 |
| 31 // Cancels any outstanding work and dismisses an alert view (if shown). |
| 32 - (void)cancelAndDismiss; |
| 33 |
| 34 // Starts sync for |browserState|. |
| 35 - (void)commitSyncForBrowserState:(ios::ChromeBrowserState*)browserState; |
| 36 |
| 37 // Fetches the managed status for |identity|. |
| 38 - (void)fetchManagedStatus:(ios::ChromeBrowserState*)browserState |
| 39 forIdentity:(ChromeIdentity*)identity; |
| 40 |
| 41 // Signs |identity| with |hostedDomain| into |browserState|. |
| 42 - (void)signInIdentity:(ChromeIdentity*)identity |
| 43 withHostedDomain:(NSString*)hostedDomain |
| 44 toBrowserState:(ios::ChromeBrowserState*)browserState; |
| 45 |
| 46 // Signs out of |browserState| and sends |didSignOut| to the delegate when |
| 47 // complete. |
| 48 - (void)signOutBrowserState:(ios::ChromeBrowserState*)browserState; |
| 49 |
| 50 // Immediately signs out |browserState| without waiting for dependent services. |
| 51 - (void)signOutImmediatelyFromBrowserState: |
| 52 (ios::ChromeBrowserState*)browserState; |
| 53 |
| 54 // Asks the user whether to clear or merge their previous identity's data with |
| 55 // that of |identity| or cancel sign-in, sending |didChooseClearDataPolicy:| |
| 56 // or |didChooseCancel| to the delegate when complete according to the user |
| 57 // action. |
| 58 - (void)promptMergeCaseForIdentity:(ChromeIdentity*)identity |
| 59 browserState:(ios::ChromeBrowserState*)browserState |
| 60 viewController:(UIViewController*)viewController; |
| 61 |
| 62 // Clears browsing data from |browserState| and sends |didClearData| to the |
| 63 // delegate when complete. |
| 64 - (void)clearData:(ios::ChromeBrowserState*)browserState; |
| 65 |
| 66 // Determines whether the user must decide what to do with |identity|'s browsing |
| 67 // data before signing into |browserState|. |
| 68 - (BOOL)shouldHandleMergeCaseForIdentity:(ChromeIdentity*)identity |
| 69 browserState:(ios::ChromeBrowserState*)browserState; |
| 70 |
| 71 // Shows a confirmation dialog for signing in to an account managed by |
| 72 // |hostedDomain|. |
| 73 - (void)showManagedConfirmationForHostedDomain:(NSString*)hostedDomain |
| 74 viewController: |
| 75 (UIViewController*)viewController; |
| 76 |
| 77 // Shows |error| to the user and calls |callback| on dismiss. |
| 78 - (void)showAuthenticationError:(NSError*)error |
| 79 withCompletion:(ProceduralBlock)callback |
| 80 viewController:(UIViewController*)viewController; |
| 81 |
| 82 @property(nonatomic, weak, readonly) id<AuthenticationFlowPerformerDelegate> |
| 83 delegate; |
| 84 |
| 85 @end |
| 86 |
| 87 #endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_AUTHENTICATION_FLOW_PERFORMER_H_ |
OLD | NEW |