| OLD | NEW |
| 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 - (void)showSettings; | 381 - (void)showSettings; |
| 382 // Shows the accounts settings UI. | 382 // Shows the accounts settings UI. |
| 383 - (void)showAccountsSettings; | 383 - (void)showAccountsSettings; |
| 384 // Shows the Sync settings UI. | 384 // Shows the Sync settings UI. |
| 385 - (void)showSyncSettings; | 385 - (void)showSyncSettings; |
| 386 // Shows the Save Passwords settings. | 386 // Shows the Save Passwords settings. |
| 387 - (void)showSavePasswordsSettings; | 387 - (void)showSavePasswordsSettings; |
| 388 // Invokes the sign in flow with the specified authentication operation and | 388 // Invokes the sign in flow with the specified authentication operation and |
| 389 // invokes |callback| when finished. | 389 // invokes |callback| when finished. |
| 390 - (void)showSigninWithOperation:(AuthenticationOperation)operation | 390 - (void)showSigninWithOperation:(AuthenticationOperation)operation |
| 391 identity:(ChromeIdentity*)identity |
| 391 accessPoint:(signin_metrics::AccessPoint)accessPoint | 392 accessPoint:(signin_metrics::AccessPoint)accessPoint |
| 392 promoAction:(signin_metrics::PromoAction)promoAction | 393 promoAction:(signin_metrics::PromoAction)promoAction |
| 393 callback:(ShowSigninCommandCompletionCallback)callback; | 394 callback:(ShowSigninCommandCompletionCallback)callback; |
| 394 // Wraps a callback with one that first checks if sign-in was completed | 395 // Wraps a callback with one that first checks if sign-in was completed |
| 395 // successfully and the profile wasn't swapped before invoking. | 396 // successfully and the profile wasn't swapped before invoking. |
| 396 - (ShowSigninCommandCompletionCallback)successfulSigninCompletion: | 397 - (ShowSigninCommandCompletionCallback)successfulSigninCompletion: |
| 397 (ProceduralBlock)callback; | 398 (ProceduralBlock)callback; |
| 398 // Shows the Sync encryption passphrase (part of Settings). | 399 // Shows the Sync encryption passphrase (part of Settings). |
| 399 - (void)showSyncEncryptionPassphrase; | 400 - (void)showSyncEncryptionPassphrase; |
| 400 // Shows the Native Apps Settings UI (part of Settings). | 401 // Shows the Native Apps Settings UI (part of Settings). |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1431 [self showReportAnIssue]; | 1432 [self showReportAnIssue]; |
| 1432 }); | 1433 }); |
| 1433 break; | 1434 break; |
| 1434 case IDC_SHOW_SIGNIN_IOS: { | 1435 case IDC_SHOW_SIGNIN_IOS: { |
| 1435 ShowSigninCommand* command = | 1436 ShowSigninCommand* command = |
| 1436 base::mac::ObjCCastStrict<ShowSigninCommand>(sender); | 1437 base::mac::ObjCCastStrict<ShowSigninCommand>(sender); |
| 1437 if (command.operation == AUTHENTICATION_OPERATION_DISMISS) { | 1438 if (command.operation == AUTHENTICATION_OPERATION_DISMISS) { |
| 1438 [self dismissSigninInteractionController]; | 1439 [self dismissSigninInteractionController]; |
| 1439 } else { | 1440 } else { |
| 1440 [self showSigninWithOperation:command.operation | 1441 [self showSigninWithOperation:command.operation |
| 1442 identity:command.identity |
| 1441 accessPoint:command.accessPoint | 1443 accessPoint:command.accessPoint |
| 1442 promoAction:command.promoAction | 1444 promoAction:command.promoAction |
| 1443 callback:command.callback]; | 1445 callback:command.callback]; |
| 1444 } | 1446 } |
| 1445 break; | 1447 break; |
| 1446 } | 1448 } |
| 1447 case IDC_SHOW_ACCOUNTS_SETTINGS: { | 1449 case IDC_SHOW_ACCOUNTS_SETTINGS: { |
| 1448 [self showAccountsSettings]; | 1450 [self showAccountsSettings]; |
| 1449 break; | 1451 break; |
| 1450 } | 1452 } |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2077 _settingsNavigationController.reset([SettingsNavigationController | 2079 _settingsNavigationController.reset([SettingsNavigationController |
| 2078 newContextualSearchController:_mainBrowserState | 2080 newContextualSearchController:_mainBrowserState |
| 2079 delegate:self]); | 2081 delegate:self]); |
| 2080 [[self topPresentedViewController] | 2082 [[self topPresentedViewController] |
| 2081 presentViewController:_settingsNavigationController | 2083 presentViewController:_settingsNavigationController |
| 2082 animated:YES | 2084 animated:YES |
| 2083 completion:nil]; | 2085 completion:nil]; |
| 2084 } | 2086 } |
| 2085 | 2087 |
| 2086 - (void)showSigninWithOperation:(AuthenticationOperation)operation | 2088 - (void)showSigninWithOperation:(AuthenticationOperation)operation |
| 2089 identity:(ChromeIdentity*)identity |
| 2087 accessPoint:(signin_metrics::AccessPoint)accessPoint | 2090 accessPoint:(signin_metrics::AccessPoint)accessPoint |
| 2088 promoAction:(signin_metrics::PromoAction)promoAction | 2091 promoAction:(signin_metrics::PromoAction)promoAction |
| 2089 callback:(ShowSigninCommandCompletionCallback)callback { | 2092 callback:(ShowSigninCommandCompletionCallback)callback { |
| 2090 DCHECK_NE(AUTHENTICATION_OPERATION_DISMISS, operation); | 2093 DCHECK_NE(AUTHENTICATION_OPERATION_DISMISS, operation); |
| 2091 | 2094 |
| 2092 if (_signinInteractionController) { | 2095 if (_signinInteractionController) { |
| 2093 // Avoid showing the sign in screen if there is already a sign-in operation | 2096 // Avoid showing the sign in screen if there is already a sign-in operation |
| 2094 // in progress. | 2097 // in progress. |
| 2095 return; | 2098 return; |
| 2096 } | 2099 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2115 NOTREACHED(); | 2118 NOTREACHED(); |
| 2116 break; | 2119 break; |
| 2117 case AUTHENTICATION_OPERATION_REAUTHENTICATE: | 2120 case AUTHENTICATION_OPERATION_REAUTHENTICATE: |
| 2118 [_signinInteractionController | 2121 [_signinInteractionController |
| 2119 reAuthenticateWithCompletion:completion | 2122 reAuthenticateWithCompletion:completion |
| 2120 viewController:self.mainViewController]; | 2123 viewController:self.mainViewController]; |
| 2121 break; | 2124 break; |
| 2122 case AUTHENTICATION_OPERATION_SIGNIN: | 2125 case AUTHENTICATION_OPERATION_SIGNIN: |
| 2123 [_signinInteractionController | 2126 [_signinInteractionController |
| 2124 signInWithViewController:self.mainViewController | 2127 signInWithViewController:self.mainViewController |
| 2125 identity:nil | 2128 identity:identity |
| 2126 completion:completion]; | 2129 completion:completion]; |
| 2127 break; | 2130 break; |
| 2128 case AUTHENTICATION_OPERATION_SIGNIN_PROMO_CONTINUE_AS: { | |
| 2129 NSArray* identities = ios::GetChromeBrowserProvider() | |
| 2130 ->GetChromeIdentityService() | |
| 2131 ->GetAllIdentitiesSortedForDisplay(); | |
| 2132 DCHECK(identities.count > 0); | |
| 2133 [_signinInteractionController | |
| 2134 signInWithViewController:self.mainViewController | |
| 2135 identity:identities[0] | |
| 2136 completion:completion]; | |
| 2137 break; | |
| 2138 } | |
| 2139 } | 2131 } |
| 2140 } | 2132 } |
| 2141 | 2133 |
| 2142 - (void)showAddAccount { | 2134 - (void)showAddAccount { |
| 2143 if (_signinInteractionController) { | 2135 if (_signinInteractionController) { |
| 2144 // Avoid showing the sign in screen if there is already a sign-in operation | 2136 // Avoid showing the sign in screen if there is already a sign-in operation |
| 2145 // in progress. | 2137 // in progress. |
| 2146 return; | 2138 return; |
| 2147 } | 2139 } |
| 2148 | 2140 |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2633 }; | 2625 }; |
| 2634 | 2626 |
| 2635 callbackCounter->IncrementCount(); | 2627 callbackCounter->IncrementCount(); |
| 2636 [self removeBrowsingDataFromBrowserState:_mainBrowserState | 2628 [self removeBrowsingDataFromBrowserState:_mainBrowserState |
| 2637 mask:removeAllMask | 2629 mask:removeAllMask |
| 2638 timePeriod:browsing_data::TimePeriod::ALL_TIME | 2630 timePeriod:browsing_data::TimePeriod::ALL_TIME |
| 2639 completionHandler:decrementCallbackCounterCount]; | 2631 completionHandler:decrementCallbackCounterCount]; |
| 2640 } | 2632 } |
| 2641 | 2633 |
| 2642 @end | 2634 @end |
| OLD | NEW |