| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" | 5 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" |
| 6 | 6 |
| 7 #import <Carbon/Carbon.h> // kVK_Return. | 7 #import <Carbon/Carbon.h> // kVK_Return. |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 | 884 |
| 885 - (IBAction)showAccountReauthenticationView:(id)sender { | 885 - (IBAction)showAccountReauthenticationView:(id)sender { |
| 886 DCHECK(!isGuestSession_); | 886 DCHECK(!isGuestSession_); |
| 887 [self showSigninUIForMode:profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH]; | 887 [self showSigninUIForMode:profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH]; |
| 888 } | 888 } |
| 889 | 889 |
| 890 - (IBAction)showUpdateChromeView:(id)sender { | 890 - (IBAction)showUpdateChromeView:(id)sender { |
| 891 chrome::OpenUpdateChromeDialog(browser_); | 891 chrome::OpenUpdateChromeDialog(browser_); |
| 892 } | 892 } |
| 893 | 893 |
| 894 - (IBAction)showSyncPassphraseSetupView:(id)sender { | 894 - (IBAction)showSyncSetupView:(id)sender { |
| 895 chrome::ShowSettingsSubPage(browser_, chrome::kSyncSetupSubPage); | 895 chrome::ShowSettingsSubPage(browser_, chrome::kSyncSetupSubPage); |
| 896 } | 896 } |
| 897 | 897 |
| 898 - (IBAction)removeAccount:(id)sender { | 898 - (IBAction)removeAccount:(id)sender { |
| 899 DCHECK(!accountIdToRemove_.empty()); | 899 DCHECK(!accountIdToRemove_.empty()); |
| 900 ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile()) | 900 ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile()) |
| 901 ->RevokeCredentials(accountIdToRemove_); | 901 ->RevokeCredentials(accountIdToRemove_); |
| 902 [self postActionPerformed:ProfileMetrics::PROFILE_DESKTOP_MENU_REMOVE_ACCT]; | 902 [self postActionPerformed:ProfileMetrics::PROFILE_DESKTOP_MENU_REMOVE_ACCT]; |
| 903 accountIdToRemove_.clear(); | 903 accountIdToRemove_.clear(); |
| 904 | 904 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 otherProfiles:otherProfiles.get() | 1200 otherProfiles:otherProfiles.get() |
| 1201 atYOffset:yOffset | 1201 atYOffset:yOffset |
| 1202 inContainer:container | 1202 inContainer:container |
| 1203 showLock:showLock]; | 1203 showLock:showLock]; |
| 1204 return container.autorelease(); | 1204 return container.autorelease(); |
| 1205 } | 1205 } |
| 1206 | 1206 |
| 1207 - (NSView*)buildSyncErrorViewIfNeeded { | 1207 - (NSView*)buildSyncErrorViewIfNeeded { |
| 1208 int contentStringId, buttonStringId; | 1208 int contentStringId, buttonStringId; |
| 1209 SEL buttonAction; | 1209 SEL buttonAction; |
| 1210 SigninManagerBase* signinManager = |
| 1211 SigninManagerFactory::GetForProfile(browser_->profile()); |
| 1210 sync_ui_util::AvatarSyncErrorType error = | 1212 sync_ui_util::AvatarSyncErrorType error = |
| 1211 sync_ui_util::GetMessagesForAvatarSyncError( | 1213 sync_ui_util::GetMessagesForAvatarSyncError( |
| 1212 browser_->profile(), &contentStringId, &buttonStringId); | 1214 browser_->profile(), *signinManager, &contentStringId, |
| 1215 &buttonStringId); |
| 1213 switch (error) { | 1216 switch (error) { |
| 1214 case sync_ui_util::MANAGED_USER_UNRECOVERABLE_ERROR: | 1217 case sync_ui_util::MANAGED_USER_UNRECOVERABLE_ERROR: |
| 1215 buttonAction = @selector(showSignoutView:); | 1218 buttonAction = @selector(showSignoutView:); |
| 1216 break; | 1219 break; |
| 1217 case sync_ui_util::UNRECOVERABLE_ERROR: | 1220 case sync_ui_util::UNRECOVERABLE_ERROR: |
| 1218 buttonAction = @selector(showSignoutSigninView:); | 1221 buttonAction = @selector(showSignoutSigninView:); |
| 1219 break; | 1222 break; |
| 1220 case sync_ui_util::SUPERVISED_USER_AUTH_ERROR: | 1223 case sync_ui_util::SUPERVISED_USER_AUTH_ERROR: |
| 1221 buttonAction = nil; | 1224 buttonAction = nil; |
| 1222 break; | 1225 break; |
| 1223 case sync_ui_util::AUTH_ERROR: | 1226 case sync_ui_util::AUTH_ERROR: |
| 1224 buttonAction = @selector(showAccountReauthenticationView:); | 1227 buttonAction = @selector(showAccountReauthenticationView:); |
| 1225 break; | 1228 break; |
| 1226 case sync_ui_util::UPGRADE_CLIENT_ERROR: | 1229 case sync_ui_util::UPGRADE_CLIENT_ERROR: |
| 1227 buttonAction = @selector(showUpdateChromeView:); | 1230 buttonAction = @selector(showUpdateChromeView:); |
| 1228 break; | 1231 break; |
| 1229 case sync_ui_util::PASSPHRASE_ERROR: | 1232 case sync_ui_util::PASSPHRASE_ERROR: |
| 1230 buttonAction = @selector(showSyncPassphraseSetupView:); | 1233 case sync_ui_util::SETTINGS_UNCONFIRMED_ERROR: |
| 1234 buttonAction = @selector(showSyncSetupView:); |
| 1231 break; | 1235 break; |
| 1232 case sync_ui_util::NO_SYNC_ERROR: | 1236 case sync_ui_util::NO_SYNC_ERROR: |
| 1233 return nil; | 1237 return nil; |
| 1234 default: | 1238 default: |
| 1235 NOTREACHED(); | 1239 NOTREACHED(); |
| 1236 } | 1240 } |
| 1237 | 1241 |
| 1238 base::scoped_nsobject<NSView> container( | 1242 base::scoped_nsobject<NSView> container( |
| 1239 [[NSView alloc] initWithFrame:NSMakeRect(0, 0, kFixedMenuWidth, 0)]); | 1243 [[NSView alloc] initWithFrame:NSMakeRect(0, 0, kFixedMenuWidth, 0)]); |
| 1240 CGFloat iconSize = 20.0; | 1244 CGFloat iconSize = 20.0; |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2109 | 2113 |
| 2110 - (void)showWindow:(id)sender { | 2114 - (void)showWindow:(id)sender { |
| 2111 [super showWindow:sender]; | 2115 [super showWindow:sender]; |
| 2112 NSEvent *event = [[NSApplication sharedApplication] currentEvent]; | 2116 NSEvent *event = [[NSApplication sharedApplication] currentEvent]; |
| 2113 if (firstProfileView_ && [event type] == NSKeyDown) { | 2117 if (firstProfileView_ && [event type] == NSKeyDown) { |
| 2114 [[self window] makeFirstResponder:firstProfileView_]; | 2118 [[self window] makeFirstResponder:firstProfileView_]; |
| 2115 } | 2119 } |
| 2116 } | 2120 } |
| 2117 | 2121 |
| 2118 @end | 2122 @end |
| OLD | NEW |