| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ios/chrome/browser/ui/authentication/chrome_signin_view_controller.h" | 5 #include "ios/chrome/browser/ui/authentication/chrome_signin_view_controller.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "ios/chrome/common/string_util.h" | 46 #include "ios/chrome/common/string_util.h" |
| 47 #include "ios/chrome/grit/ios_chromium_strings.h" | 47 #include "ios/chrome/grit/ios_chromium_strings.h" |
| 48 #include "ios/chrome/grit/ios_strings.h" | 48 #include "ios/chrome/grit/ios_strings.h" |
| 49 #import "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 49 #import "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
| 50 #import "ios/public/provider/chrome/browser/signin/chrome_identity.h" | 50 #import "ios/public/provider/chrome/browser/signin/chrome_identity.h" |
| 51 #import "ios/public/provider/chrome/browser/signin/chrome_identity_interaction_m
anager.h" | 51 #import "ios/public/provider/chrome/browser/signin/chrome_identity_interaction_m
anager.h" |
| 52 #import "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" | 52 #import "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" |
| 53 #import "ios/third_party/material_components_ios/src/components/ActivityIndicato
r/src/MaterialActivityIndicator.h" | 53 #import "ios/third_party/material_components_ios/src/components/ActivityIndicato
r/src/MaterialActivityIndicator.h" |
| 54 #import "ios/third_party/material_components_ios/src/components/Buttons/src/Mate
rialButtons.h" | 54 #import "ios/third_party/material_components_ios/src/components/Buttons/src/Mate
rialButtons.h" |
| 55 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" | 55 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat
erialPalettes.h" |
| 56 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 56 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
| 57 #import "ui/base/l10n/l10n_util.h" | 57 #import "ui/base/l10n/l10n_util.h" |
| 58 | 58 |
| 59 namespace { | 59 namespace { |
| 60 | 60 |
| 61 // Default animation duration. | 61 // Default animation duration. |
| 62 const CGFloat kAnimationDuration = 0.5f; | 62 const CGFloat kAnimationDuration = 0.5f; |
| 63 | 63 |
| 64 enum LayoutType { | 64 enum LayoutType { |
| 65 LAYOUT_REGULAR, | 65 LAYOUT_REGULAR, |
| 66 LAYOUT_COMPACT, | 66 LAYOUT_COMPACT, |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 constants.GradientHeight)]; | 833 constants.GradientHeight)]; |
| 834 [_gradientLayer setFrame:[_gradientView bounds]]; | 834 [_gradientLayer setFrame:[_gradientView bounds]]; |
| 835 | 835 |
| 836 // Layout the activity indicator in the center of the view. | 836 // Layout the activity indicator in the center of the view. |
| 837 CGRect bounds = self.view.bounds; | 837 CGRect bounds = self.view.bounds; |
| 838 [_activityIndicator | 838 [_activityIndicator |
| 839 setCenter:CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds))]; | 839 setCenter:CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds))]; |
| 840 } | 840 } |
| 841 | 841 |
| 842 - (void)layoutButtons:(const AuthenticationViewConstants&)constants { | 842 - (void)layoutButtons:(const AuthenticationViewConstants&)constants { |
| 843 [_primaryButton titleLabel].font = [[MDFRobotoFontLoader sharedInstance] | 843 [_primaryButton titleLabel].font = |
| 844 mediumFontOfSize:constants.SecondaryFontSize]; | 844 [[MDCTypography fontLoader] mediumFontOfSize:constants.SecondaryFontSize]; |
| 845 [_secondaryButton titleLabel].font = [[MDFRobotoFontLoader sharedInstance] | 845 [_secondaryButton titleLabel].font = |
| 846 mediumFontOfSize:constants.SecondaryFontSize]; | 846 [[MDCTypography fontLoader] mediumFontOfSize:constants.SecondaryFontSize]; |
| 847 | 847 |
| 848 LayoutRect primaryButtonLayout = LayoutRectZero; | 848 LayoutRect primaryButtonLayout = LayoutRectZero; |
| 849 primaryButtonLayout.boundingWidth = CGRectGetWidth(self.view.bounds); | 849 primaryButtonLayout.boundingWidth = CGRectGetWidth(self.view.bounds); |
| 850 primaryButtonLayout.size = [_primaryButton | 850 primaryButtonLayout.size = [_primaryButton |
| 851 sizeThatFits:CGSizeMake(CGFLOAT_MAX, constants.ButtonHeight)]; | 851 sizeThatFits:CGSizeMake(CGFLOAT_MAX, constants.ButtonHeight)]; |
| 852 primaryButtonLayout.position.leading = primaryButtonLayout.boundingWidth - | 852 primaryButtonLayout.position.leading = primaryButtonLayout.boundingWidth - |
| 853 primaryButtonLayout.size.width - | 853 primaryButtonLayout.size.width - |
| 854 constants.ButtonHorizontalPadding; | 854 constants.ButtonHorizontalPadding; |
| 855 primaryButtonLayout.position.originY = CGRectGetHeight(self.view.bounds) - | 855 primaryButtonLayout.position.originY = CGRectGetHeight(self.view.bounds) - |
| 856 constants.ButtonVerticalPadding - | 856 constants.ButtonVerticalPadding - |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 } | 942 } |
| 943 _hasConfirmationScreenReachedBottom = YES; | 943 _hasConfirmationScreenReachedBottom = YES; |
| 944 [self setPrimaryButtonStyling:_primaryButton]; | 944 [self setPrimaryButtonStyling:_primaryButton]; |
| 945 [_primaryButton setTitle:[self acceptSigninButtonTitle] | 945 [_primaryButton setTitle:[self acceptSigninButtonTitle] |
| 946 forState:UIControlStateNormal]; | 946 forState:UIControlStateNormal]; |
| 947 [_primaryButton setImage:nil forState:UIControlStateNormal]; | 947 [_primaryButton setImage:nil forState:UIControlStateNormal]; |
| 948 [self.view setNeedsLayout]; | 948 [self.view setNeedsLayout]; |
| 949 } | 949 } |
| 950 | 950 |
| 951 @end | 951 @end |
| OLD | NEW |