Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Unified Diff: ios/chrome/browser/ui/authentication/chrome_signin_view_controller.h

Issue 2586993002: Upstream Chrome on iOS source code [3/11]. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/authentication/chrome_signin_view_controller.h
diff --git a/ios/chrome/browser/ui/authentication/chrome_signin_view_controller.h b/ios/chrome/browser/ui/authentication/chrome_signin_view_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..f2e1c3a999ddd5f9e63377182d8dff67c2cbcca7
--- /dev/null
+++ b/ios/chrome/browser/ui/authentication/chrome_signin_view_controller.h
@@ -0,0 +1,106 @@
+// Copyright 2015 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_AUTHENTICATION_CHROME_SIGNIN_VIEW_CONTROLLER_H_
+#define IOS_CHROME_BROWSER_UI_AUTHENTICATION_CHROME_SIGNIN_VIEW_CONTROLLER_H_
+
+#import <UIKit/UIKit.h>
+
+#include "components/signin/core/browser/signin_metrics.h"
+#import "ios/chrome/browser/signin/constants.h"
+
+@class ChromeSigninViewController;
+@class GenericChromeCommand;
+@class ChromeIdentity;
+
+namespace ios {
+class ChromeBrowserState;
+} // namespace ios
+
+@protocol ChromeSigninViewControllerDelegate<NSObject>
+
+// Informs the delegate that a sign-in operation will start in |controller|.
+- (void)willStartSignIn:(ChromeSigninViewController*)controller;
+
+// Informs the delegate that an add account operation will start in
+// |controller|.
+- (void)willStartAddAccount:(ChromeSigninViewController*)controller;
+
+// Informs the delegate that the user skipped sign-in in |controller|.
+- (void)didSkipSignIn:(ChromeSigninViewController*)controller;
+
+// Informs the delegate that the sign-in failed in |controller|.
+- (void)didFailSignIn:(ChromeSigninViewController*)controller;
+
+// Informs the delegate that the user was signed in in |controller|.
+//
+// Note that the sign-in flow did not actually finish when this method is
+// called. The delegate will be called with [-didAcceptSignIn:] or
+// [-didUndoSignIn:identity:] once the user decides to accept or to undo the
+// sign-in operation.
+- (void)didSignIn:(ChromeSigninViewController*)controller;
+
+// Informs the delegate that the sign-in of |identity| was undone in
+// |controller|.
+// |identity| will be automatically forgotten if it was added during this
+// sign-in flow.
+- (void)didUndoSignIn:(ChromeSigninViewController*)controller
+ identity:(ChromeIdentity*)identity;
+
+// Informs the delegate that the user has accepted the sign-in in |controller|.
+// If |command| is not nil, the delegate is expected to execute it.
+// This marks the end of the sign-in flow.
+- (void)didAcceptSignIn:(ChromeSigninViewController*)controller
+ executeCommand:(GenericChromeCommand*)command;
+
+@end
+
+// ChromeSigninViewController is a view controller that handles all the
+// sign-in UI flow.
+@interface ChromeSigninViewController : UIViewController
+
+@property(nonatomic, assign) id<ChromeSigninViewControllerDelegate> delegate;
+
+// Data clearing policy to use during the authentication.
+// It is valid to set this in the |willStartSignIn:| method of the delegate.
+@property(nonatomic, assign) ShouldClearData shouldClearData;
+
+// Designated initializer.
+// * |browserState| is the current browser state.
+// * |isPresentedOnSettings| indicates whether the settings view controller is
+// part of the presented view controllers stack.
+// * |accessPoint| represents the access point that initiated the sign-in.
+// * |identity| will be signed in without requiring user input if not nil.
+- (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState
+ isPresentedOnSettings:(BOOL)isPresentedOnSettings
+ signInAccessPoint:(signin_metrics::AccessPoint)accessPoint
+ signInIdentity:(ChromeIdentity*)identity;
+
+// Cancels the on-going authentication operation (if any). |delegate| will be
+// called with |didFailSignIn|.
+- (void)cancel;
+
+@end
+
+@interface ChromeSigninViewController (Subclassing)
+
+@property(nonatomic, readonly) ios::ChromeBrowserState* browserState;
+
+@property(nonatomic, readonly) UIColor* backgroundColor;
+
+// Vertical padding used underneath buttons. Default value is 18.
+@property(nonatomic, assign) CGFloat buttonVerticalPadding;
+
+// Primary button title used to accept the sign-in.
+@property(nonatomic, readonly) NSString* acceptSigninButtonTitle;
+
+// Secondary button title used to skip the sign-in.
+@property(nonatomic, readonly) NSString* skipSigninButtonTitle;
+
+@property(nonatomic, readonly) UIButton* primaryButton;
+@property(nonatomic, readonly) UIButton* secondaryButton;
+
+@end
+
+#endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_CHROME_SIGNIN_VIEW_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698