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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 browser_->profile())->RevokeCredentials(accountIdToRemove_); | 889 browser_->profile())->RevokeCredentials(accountIdToRemove_); |
890 [self postActionPerformed:ProfileMetrics::PROFILE_DESKTOP_MENU_REMOVE_ACCT]; | 890 [self postActionPerformed:ProfileMetrics::PROFILE_DESKTOP_MENU_REMOVE_ACCT]; |
891 accountIdToRemove_.clear(); | 891 accountIdToRemove_.clear(); |
892 | 892 |
893 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; | 893 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; |
894 } | 894 } |
895 | 895 |
896 - (IBAction)seeWhatsNew:(id)sender { | 896 - (IBAction)seeWhatsNew:(id)sender { |
897 chrome::ShowUserManagerWithTutorial( | 897 chrome::ShowUserManagerWithTutorial( |
898 profiles::USER_MANAGER_TUTORIAL_OVERVIEW); | 898 profiles::USER_MANAGER_TUTORIAL_OVERVIEW); |
| 899 ProfileMetrics::LogProfileNewAvatarMenuUpgrade( |
| 900 ProfileMetrics::PROFILE_AVATAR_MENU_UPGRADE_WHATS_NEW); |
899 } | 901 } |
900 | 902 |
901 - (IBAction)showSwitchUserView:(id)sender { | 903 - (IBAction)showSwitchUserView:(id)sender { |
902 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_SWITCH_USER]; | 904 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_SWITCH_USER]; |
| 905 ProfileMetrics::LogProfileNewAvatarMenuUpgrade( |
| 906 ProfileMetrics::PROFILE_AVATAR_MENU_UPGRADE_NOT_YOU); |
903 } | 907 } |
904 | 908 |
905 - (IBAction)configureSyncSettings:(id)sender { | 909 - (IBAction)configureSyncSettings:(id)sender { |
906 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; | 910 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; |
907 LoginUIServiceFactory::GetForProfile(browser_->profile())-> | 911 LoginUIServiceFactory::GetForProfile(browser_->profile())-> |
908 SyncConfirmationUIClosed(true); | 912 SyncConfirmationUIClosed(true); |
| 913 ProfileMetrics::LogProfileNewAvatarMenuSignin( |
| 914 ProfileMetrics::PROFILE_AVATAR_MENU_SIGNIN_SETTINGS); |
909 } | 915 } |
910 | 916 |
911 - (IBAction)syncSettingsConfirmed:(id)sender { | 917 - (IBAction)syncSettingsConfirmed:(id)sender { |
912 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; | 918 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; |
913 LoginUIServiceFactory::GetForProfile(browser_->profile())-> | 919 LoginUIServiceFactory::GetForProfile(browser_->profile())-> |
914 SyncConfirmationUIClosed(false); | 920 SyncConfirmationUIClosed(false); |
| 921 ProfileMetrics::LogProfileNewAvatarMenuSignin( |
| 922 ProfileMetrics::PROFILE_AVATAR_MENU_SIGNIN_OK); |
915 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; | 923 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; |
916 } | 924 } |
917 | 925 |
918 - (IBAction)addPerson:(id)sender { | 926 - (IBAction)addPerson:(id)sender { |
919 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile()); | 927 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile()); |
| 928 ProfileMetrics::LogProfileNewAvatarMenuNotYou( |
| 929 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_ADD_PERSON); |
920 } | 930 } |
921 | 931 |
922 - (IBAction)disconnectProfile:(id)sender { | 932 - (IBAction)disconnectProfile:(id)sender { |
923 chrome::ShowSettings(browser_); | 933 chrome::ShowSettings(browser_); |
| 934 ProfileMetrics::LogProfileNewAvatarMenuNotYou( |
| 935 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_DISCONNECT); |
924 } | 936 } |
925 | 937 |
926 - (IBAction)navigateBackFromSwitchUserView:(id)sender { | 938 - (IBAction)navigateBackFromSwitchUserView:(id)sender { |
927 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; | 939 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; |
| 940 ProfileMetrics::LogProfileNewAvatarMenuNotYou( |
| 941 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_BACK); |
928 } | 942 } |
929 | 943 |
930 - (void)windowWillClose:(NSNotification*)notification { | 944 - (void)windowWillClose:(NSNotification*)notification { |
931 if (tutorialMode_ == profiles::TUTORIAL_MODE_CONFIRM_SIGNIN) { | 945 if (tutorialMode_ == profiles::TUTORIAL_MODE_CONFIRM_SIGNIN) { |
932 LoginUIServiceFactory::GetForProfile(browser_->profile())-> | 946 LoginUIServiceFactory::GetForProfile(browser_->profile())-> |
933 SyncConfirmationUIClosed(false); | 947 SyncConfirmationUIClosed(false); |
934 } | 948 } |
935 | 949 |
936 [super windowWillClose:notification]; | 950 [super windowWillClose:notification]; |
937 } | 951 } |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 //TODO(mlerman): update UMA stats for the new tutorials. | 1150 //TODO(mlerman): update UMA stats for the new tutorials. |
1137 } else { | 1151 } else { |
1138 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; | 1152 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; |
1139 } | 1153 } |
1140 | 1154 |
1141 [container setFrameSize:NSMakeSize(kFixedMenuWidth, yOffset)]; | 1155 [container setFrameSize:NSMakeSize(kFixedMenuWidth, yOffset)]; |
1142 return container.autorelease(); | 1156 return container.autorelease(); |
1143 } | 1157 } |
1144 | 1158 |
1145 - (NSView*)buildSigninConfirmationView { | 1159 - (NSView*)buildSigninConfirmationView { |
| 1160 ProfileMetrics::LogProfileNewAvatarMenuSignin( |
| 1161 ProfileMetrics::PROFILE_AVATAR_MENU_SIGNIN_VIEW); |
| 1162 |
1146 NSString* titleMessage = l10n_util::GetNSString( | 1163 NSString* titleMessage = l10n_util::GetNSString( |
1147 IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_TITLE); | 1164 IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_TITLE); |
1148 NSString* contentMessage = l10n_util::GetNSString( | 1165 NSString* contentMessage = l10n_util::GetNSString( |
1149 IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_CONTENT_TEXT); | 1166 IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_CONTENT_TEXT); |
1150 NSString* linkMessage = l10n_util::GetNSString( | 1167 NSString* linkMessage = l10n_util::GetNSString( |
1151 IDS_PROFILES_SYNC_SETTINGS_LINK); | 1168 IDS_PROFILES_SYNC_SETTINGS_LINK); |
1152 NSString* buttonMessage = l10n_util::GetNSString( | 1169 NSString* buttonMessage = l10n_util::GetNSString( |
1153 IDS_PROFILES_TUTORIAL_OK_BUTTON); | 1170 IDS_PROFILES_TUTORIAL_OK_BUTTON); |
1154 return [self tutorialViewWithMode:profiles::TUTORIAL_MODE_CONFIRM_SIGNIN | 1171 return [self tutorialViewWithMode:profiles::TUTORIAL_MODE_CONFIRM_SIGNIN |
1155 titleMessage:titleMessage | 1172 titleMessage:titleMessage |
(...skipping 21 matching lines...) Expand all Loading... |
1177 if (showCount > signin_ui_util::kUpgradeWelcomeTutorialShowMax) | 1194 if (showCount > signin_ui_util::kUpgradeWelcomeTutorialShowMax) |
1178 return nil; | 1195 return nil; |
1179 | 1196 |
1180 if (tutorialMode_ != profiles::TUTORIAL_MODE_WELCOME_UPGRADE) { | 1197 if (tutorialMode_ != profiles::TUTORIAL_MODE_WELCOME_UPGRADE) { |
1181 if (showCount == signin_ui_util::kUpgradeWelcomeTutorialShowMax) | 1198 if (showCount == signin_ui_util::kUpgradeWelcomeTutorialShowMax) |
1182 return nil; | 1199 return nil; |
1183 profile->GetPrefs()->SetInteger( | 1200 profile->GetPrefs()->SetInteger( |
1184 prefs::kProfileAvatarTutorialShown, showCount + 1); | 1201 prefs::kProfileAvatarTutorialShown, showCount + 1); |
1185 } | 1202 } |
1186 | 1203 |
| 1204 ProfileMetrics::LogProfileNewAvatarMenuUpgrade( |
| 1205 ProfileMetrics::PROFILE_AVATAR_MENU_UPGRADE_VIEW); |
| 1206 |
1187 NSString* titleMessage = l10n_util::GetNSString( | 1207 NSString* titleMessage = l10n_util::GetNSString( |
1188 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_TITLE); | 1208 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_TITLE); |
1189 NSString* contentMessage = l10n_util::GetNSString( | 1209 NSString* contentMessage = l10n_util::GetNSString( |
1190 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_CONTENT_TEXT); | 1210 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_CONTENT_TEXT); |
1191 NSString* linkMessage = l10n_util::GetNSStringF( | 1211 NSString* linkMessage = l10n_util::GetNSStringF( |
1192 IDS_PROFILES_NOT_YOU, avatarItem.name); | 1212 IDS_PROFILES_NOT_YOU, avatarItem.name); |
1193 NSString* buttonMessage = l10n_util::GetNSString( | 1213 NSString* buttonMessage = l10n_util::GetNSString( |
1194 IDS_PROFILES_TUTORIAL_WHATS_NEW_BUTTON); | 1214 IDS_PROFILES_TUTORIAL_WHATS_NEW_BUTTON); |
1195 return [self tutorialViewWithMode:profiles::TUTORIAL_MODE_WELCOME_UPGRADE | 1215 return [self tutorialViewWithMode:profiles::TUTORIAL_MODE_WELCOME_UPGRADE |
1196 titleMessage:titleMessage | 1216 titleMessage:titleMessage |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 @selector(showAccountManagement:) /* backButtonAction */); | 1778 @selector(showAccountManagement:) /* backButtonAction */); |
1759 [container addSubview:titleView]; | 1779 [container addSubview:titleView]; |
1760 yOffset = NSMaxY([titleView frame]); | 1780 yOffset = NSMaxY([titleView frame]); |
1761 | 1781 |
1762 [container setFrameSize:NSMakeSize(kFixedAccountRemovalViewWidth, yOffset)]; | 1782 [container setFrameSize:NSMakeSize(kFixedAccountRemovalViewWidth, yOffset)]; |
1763 return container.autorelease(); | 1783 return container.autorelease(); |
1764 } | 1784 } |
1765 | 1785 |
1766 | 1786 |
1767 - (NSView*)buildSwitchUserView { | 1787 - (NSView*)buildSwitchUserView { |
| 1788 ProfileMetrics::LogProfileNewAvatarMenuNotYou( |
| 1789 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_VIEW); |
1768 base::scoped_nsobject<NSView> container( | 1790 base::scoped_nsobject<NSView> container( |
1769 [[NSView alloc] initWithFrame:NSZeroRect]); | 1791 [[NSView alloc] initWithFrame:NSZeroRect]); |
1770 CGFloat availableWidth = | 1792 CGFloat availableWidth = |
1771 kFixedSwitchUserViewWidth - 2 * kHorizontalSpacing; | 1793 kFixedSwitchUserViewWidth - 2 * kHorizontalSpacing; |
1772 CGFloat yOffset = 0; | 1794 CGFloat yOffset = 0; |
1773 NSRect viewRect = NSMakeRect(0, yOffset, | 1795 NSRect viewRect = NSMakeRect(0, yOffset, |
1774 kFixedSwitchUserViewWidth, | 1796 kFixedSwitchUserViewWidth, |
1775 kBlueButtonHeight + kSmallVerticalSpacing); | 1797 kBlueButtonHeight + kSmallVerticalSpacing); |
1776 | 1798 |
1777 const AvatarMenu::Item& avatarItem = | 1799 const AvatarMenu::Item& avatarItem = |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1954 } | 1976 } |
1955 | 1977 |
1956 - (bool)shouldShowGoIncognito { | 1978 - (bool)shouldShowGoIncognito { |
1957 bool incognitoAvailable = | 1979 bool incognitoAvailable = |
1958 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1980 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
1959 IncognitoModePrefs::DISABLED; | 1981 IncognitoModePrefs::DISABLED; |
1960 return incognitoAvailable && !browser_->profile()->IsGuestSession(); | 1982 return incognitoAvailable && !browser_->profile()->IsGuestSession(); |
1961 } | 1983 } |
1962 | 1984 |
1963 @end | 1985 @end |
OLD | NEW |