| 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" | 7 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" |
| 8 | 8 |
| 9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 browser_->profile())->RevokeCredentials(accountIdToRemove_); | 893 browser_->profile())->RevokeCredentials(accountIdToRemove_); |
| 894 [self postActionPerformed:ProfileMetrics::PROFILE_DESKTOP_MENU_REMOVE_ACCT]; | 894 [self postActionPerformed:ProfileMetrics::PROFILE_DESKTOP_MENU_REMOVE_ACCT]; |
| 895 accountIdToRemove_.clear(); | 895 accountIdToRemove_.clear(); |
| 896 | 896 |
| 897 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; | 897 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; |
| 898 } | 898 } |
| 899 | 899 |
| 900 - (IBAction)seeWhatsNew:(id)sender { | 900 - (IBAction)seeWhatsNew:(id)sender { |
| 901 chrome::ShowUserManagerWithTutorial( | 901 chrome::ShowUserManagerWithTutorial( |
| 902 profiles::USER_MANAGER_TUTORIAL_OVERVIEW); | 902 profiles::USER_MANAGER_TUTORIAL_OVERVIEW); |
| 903 ProfileMetrics::LogProfileNewAvatarMenuUpgrade( |
| 904 ProfileMetrics::PROFILE_AVATAR_MENU_UPGRADE_WHATS_NEW); |
| 903 } | 905 } |
| 904 | 906 |
| 905 - (IBAction)showSwitchUserView:(id)sender { | 907 - (IBAction)showSwitchUserView:(id)sender { |
| 906 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_SWITCH_USER]; | 908 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_SWITCH_USER]; |
| 909 ProfileMetrics::LogProfileNewAvatarMenuUpgrade( |
| 910 ProfileMetrics::PROFILE_AVATAR_MENU_UPGRADE_NOT_YOU); |
| 907 } | 911 } |
| 908 | 912 |
| 909 - (IBAction)configureSyncSettings:(id)sender { | 913 - (IBAction)configureSyncSettings:(id)sender { |
| 910 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; | 914 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; |
| 911 LoginUIServiceFactory::GetForProfile(browser_->profile())-> | 915 LoginUIServiceFactory::GetForProfile(browser_->profile())-> |
| 912 SyncConfirmationUIClosed(true); | 916 SyncConfirmationUIClosed(true); |
| 917 ProfileMetrics::LogProfileDesktopSignin( |
| 918 ProfileMetrics::PROFILE_DESKTOP_SIGNIN_SETTINGS); |
| 913 } | 919 } |
| 914 | 920 |
| 915 - (IBAction)syncSettingsConfirmed:(id)sender { | 921 - (IBAction)syncSettingsConfirmed:(id)sender { |
| 916 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; | 922 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; |
| 917 LoginUIServiceFactory::GetForProfile(browser_->profile())-> | 923 LoginUIServiceFactory::GetForProfile(browser_->profile())-> |
| 918 SyncConfirmationUIClosed(false); | 924 SyncConfirmationUIClosed(false); |
| 925 ProfileMetrics::LogProfileDesktopSignin( |
| 926 ProfileMetrics::PROFILE_DESKTOP_SIGNIN_OK); |
| 919 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; | 927 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; |
| 920 } | 928 } |
| 921 | 929 |
| 922 - (IBAction)addPerson:(id)sender { | 930 - (IBAction)addPerson:(id)sender { |
| 923 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile()); | 931 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile()); |
| 932 ProfileMetrics::LogProfileNewAvatarMenuNotYou( |
| 933 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_ADD_PERSON); |
| 924 } | 934 } |
| 925 | 935 |
| 926 - (IBAction)disconnectProfile:(id)sender { | 936 - (IBAction)disconnectProfile:(id)sender { |
| 927 chrome::ShowSettings(browser_); | 937 chrome::ShowSettings(browser_); |
| 938 ProfileMetrics::LogProfileNewAvatarMenuNotYou( |
| 939 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_DISCONNECT); |
| 928 } | 940 } |
| 929 | 941 |
| 930 - (IBAction)navigateBackFromSwitchUserView:(id)sender { | 942 - (IBAction)navigateBackFromSwitchUserView:(id)sender { |
| 931 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; | 943 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; |
| 944 ProfileMetrics::LogProfileNewAvatarMenuNotYou( |
| 945 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_BACK); |
| 932 } | 946 } |
| 933 | 947 |
| 934 - (void)windowWillClose:(NSNotification*)notification { | 948 - (void)windowWillClose:(NSNotification*)notification { |
| 935 if (tutorialMode_ == profiles::TUTORIAL_MODE_CONFIRM_SIGNIN) { | 949 if (tutorialMode_ == profiles::TUTORIAL_MODE_CONFIRM_SIGNIN) { |
| 936 LoginUIServiceFactory::GetForProfile(browser_->profile())-> | 950 LoginUIServiceFactory::GetForProfile(browser_->profile())-> |
| 937 SyncConfirmationUIClosed(false); | 951 SyncConfirmationUIClosed(false); |
| 938 } | 952 } |
| 939 | 953 |
| 940 [super windowWillClose:notification]; | 954 [super windowWillClose:notification]; |
| 941 } | 955 } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 //TODO(mlerman): update UMA stats for the new tutorials. | 1154 //TODO(mlerman): update UMA stats for the new tutorials. |
| 1141 } else { | 1155 } else { |
| 1142 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; | 1156 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; |
| 1143 } | 1157 } |
| 1144 | 1158 |
| 1145 [container setFrameSize:NSMakeSize(kFixedMenuWidth, yOffset)]; | 1159 [container setFrameSize:NSMakeSize(kFixedMenuWidth, yOffset)]; |
| 1146 return container.autorelease(); | 1160 return container.autorelease(); |
| 1147 } | 1161 } |
| 1148 | 1162 |
| 1149 - (NSView*)buildSigninConfirmationView { | 1163 - (NSView*)buildSigninConfirmationView { |
| 1164 ProfileMetrics::LogProfileDesktopSignin( |
| 1165 ProfileMetrics::PROFILE_DESKTOP_SIGNIN_VIEW); |
| 1166 |
| 1150 NSString* titleMessage = l10n_util::GetNSString( | 1167 NSString* titleMessage = l10n_util::GetNSString( |
| 1151 IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_TITLE); | 1168 IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_TITLE); |
| 1152 NSString* contentMessage = l10n_util::GetNSString( | 1169 NSString* contentMessage = l10n_util::GetNSString( |
| 1153 IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_CONTENT_TEXT); | 1170 IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_CONTENT_TEXT); |
| 1154 NSString* linkMessage = l10n_util::GetNSString( | 1171 NSString* linkMessage = l10n_util::GetNSString( |
| 1155 IDS_PROFILES_SYNC_SETTINGS_LINK); | 1172 IDS_PROFILES_SYNC_SETTINGS_LINK); |
| 1156 NSString* buttonMessage = l10n_util::GetNSString( | 1173 NSString* buttonMessage = l10n_util::GetNSString( |
| 1157 IDS_PROFILES_TUTORIAL_OK_BUTTON); | 1174 IDS_PROFILES_TUTORIAL_OK_BUTTON); |
| 1158 return [self tutorialViewWithMode:profiles::TUTORIAL_MODE_CONFIRM_SIGNIN | 1175 return [self tutorialViewWithMode:profiles::TUTORIAL_MODE_CONFIRM_SIGNIN |
| 1159 titleMessage:titleMessage | 1176 titleMessage:titleMessage |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1183 if (showCount > kUpgradeWelcomeTutorialShowMax) | 1200 if (showCount > kUpgradeWelcomeTutorialShowMax) |
| 1184 return nil; | 1201 return nil; |
| 1185 | 1202 |
| 1186 if (tutorialMode_ != profiles::TUTORIAL_MODE_WELCOME_UPGRADE) { | 1203 if (tutorialMode_ != profiles::TUTORIAL_MODE_WELCOME_UPGRADE) { |
| 1187 if (showCount == kUpgradeWelcomeTutorialShowMax) | 1204 if (showCount == kUpgradeWelcomeTutorialShowMax) |
| 1188 return nil; | 1205 return nil; |
| 1189 profile->GetPrefs()->SetInteger( | 1206 profile->GetPrefs()->SetInteger( |
| 1190 prefs::kProfileAvatarTutorialShown, showCount + 1); | 1207 prefs::kProfileAvatarTutorialShown, showCount + 1); |
| 1191 } | 1208 } |
| 1192 | 1209 |
| 1210 ProfileMetrics::LogProfileNewAvatarMenuUpgrade( |
| 1211 ProfileMetrics::PROFILE_AVATAR_MENU_UPGRADE_VIEW); |
| 1212 |
| 1193 NSString* titleMessage = l10n_util::GetNSStringF( | 1213 NSString* titleMessage = l10n_util::GetNSStringF( |
| 1194 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_TITLE, avatarItem.name); | 1214 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_TITLE, avatarItem.name); |
| 1195 NSString* contentMessage = l10n_util::GetNSString( | 1215 NSString* contentMessage = l10n_util::GetNSString( |
| 1196 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_CONTENT_TEXT); | 1216 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_CONTENT_TEXT); |
| 1197 NSString* linkMessage = l10n_util::GetNSStringF( | 1217 NSString* linkMessage = l10n_util::GetNSStringF( |
| 1198 IDS_PROFILES_NOT_YOU, avatarItem.name); | 1218 IDS_PROFILES_NOT_YOU, avatarItem.name); |
| 1199 NSString* buttonMessage = l10n_util::GetNSString( | 1219 NSString* buttonMessage = l10n_util::GetNSString( |
| 1200 IDS_PROFILES_TUTORIAL_WHATS_NEW_BUTTON); | 1220 IDS_PROFILES_TUTORIAL_WHATS_NEW_BUTTON); |
| 1201 return [self tutorialViewWithMode:profiles::TUTORIAL_MODE_WELCOME_UPGRADE | 1221 return [self tutorialViewWithMode:profiles::TUTORIAL_MODE_WELCOME_UPGRADE |
| 1202 titleMessage:titleMessage | 1222 titleMessage:titleMessage |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1765 @selector(showAccountManagement:) /* backButtonAction */); | 1785 @selector(showAccountManagement:) /* backButtonAction */); |
| 1766 [container addSubview:titleView]; | 1786 [container addSubview:titleView]; |
| 1767 yOffset = NSMaxY([titleView frame]); | 1787 yOffset = NSMaxY([titleView frame]); |
| 1768 | 1788 |
| 1769 [container setFrameSize:NSMakeSize(kFixedAccountRemovalViewWidth, yOffset)]; | 1789 [container setFrameSize:NSMakeSize(kFixedAccountRemovalViewWidth, yOffset)]; |
| 1770 return container.autorelease(); | 1790 return container.autorelease(); |
| 1771 } | 1791 } |
| 1772 | 1792 |
| 1773 | 1793 |
| 1774 - (NSView*)buildSwitchUserView { | 1794 - (NSView*)buildSwitchUserView { |
| 1795 ProfileMetrics::LogProfileNewAvatarMenuNotYou( |
| 1796 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_VIEW); |
| 1775 base::scoped_nsobject<NSView> container( | 1797 base::scoped_nsobject<NSView> container( |
| 1776 [[NSView alloc] initWithFrame:NSZeroRect]); | 1798 [[NSView alloc] initWithFrame:NSZeroRect]); |
| 1777 CGFloat availableWidth = | 1799 CGFloat availableWidth = |
| 1778 kFixedSwitchUserViewWidth - 2 * kHorizontalSpacing; | 1800 kFixedSwitchUserViewWidth - 2 * kHorizontalSpacing; |
| 1779 CGFloat yOffset = 0; | 1801 CGFloat yOffset = 0; |
| 1780 NSRect viewRect = NSMakeRect(0, yOffset, | 1802 NSRect viewRect = NSMakeRect(0, yOffset, |
| 1781 kFixedSwitchUserViewWidth, | 1803 kFixedSwitchUserViewWidth, |
| 1782 kBlueButtonHeight + kSmallVerticalSpacing); | 1804 kBlueButtonHeight + kSmallVerticalSpacing); |
| 1783 | 1805 |
| 1784 const AvatarMenu::Item& avatarItem = | 1806 const AvatarMenu::Item& avatarItem = |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1961 } | 1983 } |
| 1962 | 1984 |
| 1963 - (bool)shouldShowGoIncognito { | 1985 - (bool)shouldShowGoIncognito { |
| 1964 bool incognitoAvailable = | 1986 bool incognitoAvailable = |
| 1965 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1987 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 1966 IncognitoModePrefs::DISABLED; | 1988 IncognitoModePrefs::DISABLED; |
| 1967 return incognitoAvailable && !browser_->profile()->IsGuestSession(); | 1989 return incognitoAvailable && !browser_->profile()->IsGuestSession(); |
| 1968 } | 1990 } |
| 1969 | 1991 |
| 1970 @end | 1992 @end |
| OLD | NEW |