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

Side by Side Diff: ios/chrome/app/main_controller.mm

Issue 2880333003: Adding ChromeIdentity in ShowSigninCommand. (Closed)
Patch Set: Created 3 years, 7 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 #import "ios/chrome/app/main_controller.h" 5 #import "ios/chrome/app/main_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #import <CoreSpotlight/CoreSpotlight.h> 10 #import <CoreSpotlight/CoreSpotlight.h>
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 - (void)showSettings; 380 - (void)showSettings;
381 // Shows the accounts settings UI. 381 // Shows the accounts settings UI.
382 - (void)showAccountsSettings; 382 - (void)showAccountsSettings;
383 // Shows the Sync settings UI. 383 // Shows the Sync settings UI.
384 - (void)showSyncSettings; 384 - (void)showSyncSettings;
385 // Shows the Save Passwords settings. 385 // Shows the Save Passwords settings.
386 - (void)showSavePasswordsSettings; 386 - (void)showSavePasswordsSettings;
387 // Invokes the sign in flow with the specified authentication operation and 387 // Invokes the sign in flow with the specified authentication operation and
388 // invokes |callback| when finished. 388 // invokes |callback| when finished.
389 - (void)showSigninWithOperation:(AuthenticationOperation)operation 389 - (void)showSigninWithOperation:(AuthenticationOperation)operation
390 identity:(ChromeIdentity*)identity
390 accessPoint:(signin_metrics::AccessPoint)accessPoint 391 accessPoint:(signin_metrics::AccessPoint)accessPoint
391 promoAction:(signin_metrics::PromoAction)promoAction 392 promoAction:(signin_metrics::PromoAction)promoAction
392 callback:(ShowSigninCommandCompletionCallback)callback; 393 callback:(ShowSigninCommandCompletionCallback)callback;
393 // Wraps a callback with one that first checks if sign-in was completed 394 // Wraps a callback with one that first checks if sign-in was completed
394 // successfully and the profile wasn't swapped before invoking. 395 // successfully and the profile wasn't swapped before invoking.
395 - (ShowSigninCommandCompletionCallback)successfulSigninCompletion: 396 - (ShowSigninCommandCompletionCallback)successfulSigninCompletion:
396 (ProceduralBlock)callback; 397 (ProceduralBlock)callback;
397 // Shows the Sync encryption passphrase (part of Settings). 398 // Shows the Sync encryption passphrase (part of Settings).
398 - (void)showSyncEncryptionPassphrase; 399 - (void)showSyncEncryptionPassphrase;
399 // Shows the Native Apps Settings UI (part of Settings). 400 // Shows the Native Apps Settings UI (part of Settings).
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 [self showReportAnIssue]; 1428 [self showReportAnIssue];
1428 }); 1429 });
1429 break; 1430 break;
1430 case IDC_SHOW_SIGNIN_IOS: { 1431 case IDC_SHOW_SIGNIN_IOS: {
1431 ShowSigninCommand* command = 1432 ShowSigninCommand* command =
1432 base::mac::ObjCCastStrict<ShowSigninCommand>(sender); 1433 base::mac::ObjCCastStrict<ShowSigninCommand>(sender);
1433 if (command.operation == AUTHENTICATION_OPERATION_DISMISS) { 1434 if (command.operation == AUTHENTICATION_OPERATION_DISMISS) {
1434 [self dismissSigninInteractionController]; 1435 [self dismissSigninInteractionController];
1435 } else { 1436 } else {
1436 [self showSigninWithOperation:command.operation 1437 [self showSigninWithOperation:command.operation
1438 identity:command.identity
1437 accessPoint:command.accessPoint 1439 accessPoint:command.accessPoint
1438 promoAction:command.promoAction 1440 promoAction:command.promoAction
1439 callback:command.callback]; 1441 callback:command.callback];
1440 } 1442 }
1441 break; 1443 break;
1442 } 1444 }
1443 case IDC_SHOW_ACCOUNTS_SETTINGS: { 1445 case IDC_SHOW_ACCOUNTS_SETTINGS: {
1444 [self showAccountsSettings]; 1446 [self showAccountsSettings];
1445 break; 1447 break;
1446 } 1448 }
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
2073 _settingsNavigationController.reset([SettingsNavigationController 2075 _settingsNavigationController.reset([SettingsNavigationController
2074 newContextualSearchController:_mainBrowserState 2076 newContextualSearchController:_mainBrowserState
2075 delegate:self]); 2077 delegate:self]);
2076 [[self topPresentedViewController] 2078 [[self topPresentedViewController]
2077 presentViewController:_settingsNavigationController 2079 presentViewController:_settingsNavigationController
2078 animated:YES 2080 animated:YES
2079 completion:nil]; 2081 completion:nil];
2080 } 2082 }
2081 2083
2082 - (void)showSigninWithOperation:(AuthenticationOperation)operation 2084 - (void)showSigninWithOperation:(AuthenticationOperation)operation
2085 identity:(ChromeIdentity*)identity
2083 accessPoint:(signin_metrics::AccessPoint)accessPoint 2086 accessPoint:(signin_metrics::AccessPoint)accessPoint
2084 promoAction:(signin_metrics::PromoAction)promoAction 2087 promoAction:(signin_metrics::PromoAction)promoAction
2085 callback:(ShowSigninCommandCompletionCallback)callback { 2088 callback:(ShowSigninCommandCompletionCallback)callback {
2086 DCHECK_NE(AUTHENTICATION_OPERATION_DISMISS, operation); 2089 DCHECK_NE(AUTHENTICATION_OPERATION_DISMISS, operation);
2087 2090
2088 if (_signinInteractionController) { 2091 if (_signinInteractionController) {
2089 // Avoid showing the sign in screen if there is already a sign-in operation 2092 // Avoid showing the sign in screen if there is already a sign-in operation
2090 // in progress. 2093 // in progress.
2091 return; 2094 return;
2092 } 2095 }
(...skipping 16 matching lines...) Expand all
2109 case AUTHENTICATION_OPERATION_DISMISS: 2112 case AUTHENTICATION_OPERATION_DISMISS:
2110 // Special case handled above. 2113 // Special case handled above.
2111 NOTREACHED(); 2114 NOTREACHED();
2112 break; 2115 break;
2113 case AUTHENTICATION_OPERATION_REAUTHENTICATE: 2116 case AUTHENTICATION_OPERATION_REAUTHENTICATE:
2114 [_signinInteractionController 2117 [_signinInteractionController
2115 reAuthenticateWithCompletion:completion 2118 reAuthenticateWithCompletion:completion
2116 viewController:self.mainViewController]; 2119 viewController:self.mainViewController];
2117 break; 2120 break;
2118 case AUTHENTICATION_OPERATION_SIGNIN: 2121 case AUTHENTICATION_OPERATION_SIGNIN:
2122 DCHECK(!identity);
msarda 2017/05/16 13:33:53 Remove this new DCHECK (see comment below).
jlebel 2017/05/16 17:55:08 Done.
2119 [_signinInteractionController 2123 [_signinInteractionController
2120 signInWithViewController:self.mainViewController 2124 signInWithViewController:self.mainViewController
2121 identity:nil 2125 identity:nil
2122 completion:completion]; 2126 completion:completion];
2123 break; 2127 break;
2124 case AUTHENTICATION_OPERATION_SIGNIN_PROMO_CONTINUE_AS: { 2128 case AUTHENTICATION_OPERATION_SIGNIN_PROMO_CONTINUE_AS:
msarda 2017/05/16 13:33:53 I think we should remove AUTHENTICATION_OPERATION_
jlebel 2017/05/16 17:55:08 Done.
2125 NSArray* identities = ios::GetChromeBrowserProvider() 2129 DCHECK(identity);
2126 ->GetChromeIdentityService()
2127 ->GetAllIdentitiesSortedForDisplay();
2128 DCHECK(identities.count > 0);
2129 [_signinInteractionController 2130 [_signinInteractionController
2130 signInWithViewController:self.mainViewController 2131 signInWithViewController:self.mainViewController
2131 identity:identities[0] 2132 identity:identity
2132 completion:completion]; 2133 completion:completion];
2133 break; 2134 break;
2134 }
2135 } 2135 }
2136 } 2136 }
2137 2137
2138 - (void)showAddAccount { 2138 - (void)showAddAccount {
2139 if (_signinInteractionController) { 2139 if (_signinInteractionController) {
2140 // Avoid showing the sign in screen if there is already a sign-in operation 2140 // Avoid showing the sign in screen if there is already a sign-in operation
2141 // in progress. 2141 // in progress.
2142 return; 2142 return;
2143 } 2143 }
2144 2144
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
2629 }; 2629 };
2630 2630
2631 callbackCounter->IncrementCount(); 2631 callbackCounter->IncrementCount();
2632 [self removeBrowsingDataFromBrowserState:_mainBrowserState 2632 [self removeBrowsingDataFromBrowserState:_mainBrowserState
2633 mask:removeAllMask 2633 mask:removeAllMask
2634 timePeriod:browsing_data::TimePeriod::ALL_TIME 2634 timePeriod:browsing_data::TimePeriod::ALL_TIME
2635 completionHandler:decrementCallbackCounterCount]; 2635 completionHandler:decrementCallbackCounterCount];
2636 } 2636 }
2637 2637
2638 @end 2638 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698