| 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 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 yOffset += kVerticalSpacing; | 1092 yOffset += kVerticalSpacing; |
| 1093 [currentProfileView setFrameOrigin:NSMakePoint(0, yOffset)]; | 1093 [currentProfileView setFrameOrigin:NSMakePoint(0, yOffset)]; |
| 1094 [container addSubview:currentProfileView]; | 1094 [container addSubview:currentProfileView]; |
| 1095 yOffset = NSMaxY([currentProfileView frame]) + kVerticalSpacing; | 1095 yOffset = NSMaxY([currentProfileView frame]) + kVerticalSpacing; |
| 1096 } | 1096 } |
| 1097 | 1097 |
| 1098 if (tutorialView) { | 1098 if (tutorialView) { |
| 1099 [tutorialView setFrameOrigin:NSMakePoint(0, yOffset)]; | 1099 [tutorialView setFrameOrigin:NSMakePoint(0, yOffset)]; |
| 1100 [container addSubview:tutorialView]; | 1100 [container addSubview:tutorialView]; |
| 1101 yOffset = NSMaxY([tutorialView frame]); | 1101 yOffset = NSMaxY([tutorialView frame]); |
| 1102 if (!switches::IsNewProfileManagement() && | 1102 if (!switches::IsEnableAccountConsistency() && |
| 1103 tutorialMode_ != lastTutorialMode) { | 1103 tutorialMode_ != lastTutorialMode) { |
| 1104 ProfileMetrics::LogProfileUpgradeEnrollment( | 1104 ProfileMetrics::LogProfileUpgradeEnrollment( |
| 1105 ProfileMetrics::PROFILE_ENROLLMENT_SHOW_PREVIEW_PROMO); | 1105 ProfileMetrics::PROFILE_ENROLLMENT_SHOW_PREVIEW_PROMO); |
| 1106 } | 1106 } |
| 1107 } else { | 1107 } else { |
| 1108 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; | 1108 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 [container setFrameSize:NSMakeSize(kFixedMenuWidth, yOffset)]; | 1111 [container setFrameSize:NSMakeSize(kFixedMenuWidth, yOffset)]; |
| 1112 return container.autorelease(); | 1112 return container.autorelease(); |
| 1113 } | 1113 } |
| 1114 | 1114 |
| 1115 - (NSView*)buildPreviewTutorialIfNeeded:(const AvatarMenu::Item&)item { | 1115 - (NSView*)buildPreviewTutorialIfNeeded:(const AvatarMenu::Item&)item { |
| 1116 if (!switches::IsNewProfileManagement()) { | 1116 if (!switches::IsEnableAccountConsistency()) { |
| 1117 return [self tutorialViewWithMode:profiles::TUTORIAL_MODE_ENABLE_PREVIEW | 1117 return [self tutorialViewWithMode:profiles::TUTORIAL_MODE_ENABLE_PREVIEW |
| 1118 titleMessage:IDS_PROFILES_PREVIEW_TUTORIAL_TITLE | 1118 titleMessage:IDS_PROFILES_PREVIEW_TUTORIAL_TITLE |
| 1119 contentMessage:IDS_PROFILES_PREVIEW_TUTORIAL_CONTENT_TEXT | 1119 contentMessage:IDS_PROFILES_PREVIEW_TUTORIAL_CONTENT_TEXT |
| 1120 linkMessage:IDS_PROFILES_PROFILE_TUTORIAL_LEARN_MORE | 1120 linkMessage:IDS_PROFILES_PROFILE_TUTORIAL_LEARN_MORE |
| 1121 buttonMessage:IDS_PROFILES_TUTORIAL_TRY_BUTTON | 1121 buttonMessage:IDS_PROFILES_TUTORIAL_TRY_BUTTON |
| 1122 linkAction:@selector(openTutorialLearnMoreURL:) | 1122 linkAction:@selector(openTutorialLearnMoreURL:) |
| 1123 buttonAction: | 1123 buttonAction: |
| 1124 @selector(enableNewProfileManagementPreview:)]; | 1124 @selector(enableNewProfileManagementPreview:)]; |
| 1125 } | 1125 } |
| 1126 | 1126 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 buttonAction:@selector(dismissTutorial:)]; | 1162 buttonAction:@selector(dismissTutorial:)]; |
| 1163 } | 1163 } |
| 1164 | 1164 |
| 1165 - (NSView*)tutorialViewWithMode:(profiles::TutorialMode)mode | 1165 - (NSView*)tutorialViewWithMode:(profiles::TutorialMode)mode |
| 1166 titleMessage:(int)titleMessageId | 1166 titleMessage:(int)titleMessageId |
| 1167 contentMessage:(int)contentMessageId | 1167 contentMessage:(int)contentMessageId |
| 1168 linkMessage:(int)linkMessageId | 1168 linkMessage:(int)linkMessageId |
| 1169 buttonMessage:(int)buttonMessageId | 1169 buttonMessage:(int)buttonMessageId |
| 1170 linkAction:(SEL)linkAction | 1170 linkAction:(SEL)linkAction |
| 1171 buttonAction:(SEL)buttonAction { | 1171 buttonAction:(SEL)buttonAction { |
| 1172 // No promotion to Enable Accounst Consistency. |
| 1173 if (mode == profiles::TUTORIAL_MODE_ENABLE_PREVIEW) |
| 1174 return nil; |
| 1175 |
| 1172 tutorialMode_ = mode; | 1176 tutorialMode_ = mode; |
| 1173 | 1177 |
| 1174 NSColor* tutorialBackgroundColor = | 1178 NSColor* tutorialBackgroundColor = |
| 1175 gfx::SkColorToSRGBNSColor(profiles::kAvatarTutorialBackgroundColor); | 1179 gfx::SkColorToSRGBNSColor(profiles::kAvatarTutorialBackgroundColor); |
| 1176 base::scoped_nsobject<NSView> container([[BackgroundColorView alloc] | 1180 base::scoped_nsobject<NSView> container([[BackgroundColorView alloc] |
| 1177 initWithFrame:NSMakeRect(0, 0, kFixedMenuWidth, 0) | 1181 initWithFrame:NSMakeRect(0, 0, kFixedMenuWidth, 0) |
| 1178 withColor:tutorialBackgroundColor]); | 1182 withColor:tutorialBackgroundColor]); |
| 1179 CGFloat availableWidth = kFixedMenuWidth - 2 * kHorizontalSpacing; | 1183 CGFloat availableWidth = kFixedMenuWidth - 2 * kHorizontalSpacing; |
| 1180 CGFloat yOffset = kSmallVerticalSpacing; | 1184 CGFloat yOffset = kSmallVerticalSpacing; |
| 1181 | 1185 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1357 - (NSView*)createCurrentProfileLinksForItem:(const AvatarMenu::Item&)item | 1361 - (NSView*)createCurrentProfileLinksForItem:(const AvatarMenu::Item&)item |
| 1358 rect:(NSRect)rect { | 1362 rect:(NSRect)rect { |
| 1359 base::scoped_nsobject<NSView> container([[NSView alloc] initWithFrame:rect]); | 1363 base::scoped_nsobject<NSView> container([[NSView alloc] initWithFrame:rect]); |
| 1360 | 1364 |
| 1361 // Don't double-apply the left margin to the sub-views. | 1365 // Don't double-apply the left margin to the sub-views. |
| 1362 rect.origin.x = 0; | 1366 rect.origin.x = 0; |
| 1363 | 1367 |
| 1364 // The available links depend on the type of profile that is active. | 1368 // The available links depend on the type of profile that is active. |
| 1365 NSButton* link; | 1369 NSButton* link; |
| 1366 if (item.signed_in) { | 1370 if (item.signed_in) { |
| 1367 if (switches::IsNewProfileManagement()) { | 1371 if (switches::IsEnableAccountConsistency()) { |
| 1368 NSString* linkTitle = l10n_util::GetNSString( | 1372 NSString* linkTitle = l10n_util::GetNSString( |
| 1369 viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER ? | 1373 viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER ? |
| 1370 IDS_PROFILES_PROFILE_MANAGE_ACCOUNTS_BUTTON : | 1374 IDS_PROFILES_PROFILE_MANAGE_ACCOUNTS_BUTTON : |
| 1371 IDS_PROFILES_PROFILE_HIDE_MANAGE_ACCOUNTS_BUTTON); | 1375 IDS_PROFILES_PROFILE_HIDE_MANAGE_ACCOUNTS_BUTTON); |
| 1372 SEL linkSelector = | 1376 SEL linkSelector = |
| 1373 (viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) ? | 1377 (viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) ? |
| 1374 @selector(showAccountManagement:) : @selector(hideAccountManagement:); | 1378 @selector(showAccountManagement:) : @selector(hideAccountManagement:); |
| 1375 link = [self linkButtonWithTitle:linkTitle | 1379 link = [self linkButtonWithTitle:linkTitle |
| 1376 frameOrigin:rect.origin | 1380 frameOrigin:rect.origin |
| 1377 action:linkSelector]; | 1381 action:linkSelector]; |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1891 | 1895 |
| 1892 return button.autorelease(); | 1896 return button.autorelease(); |
| 1893 } | 1897 } |
| 1894 | 1898 |
| 1895 - (void)postActionPerformed:(ProfileMetrics::ProfileDesktopMenu)action { | 1899 - (void)postActionPerformed:(ProfileMetrics::ProfileDesktopMenu)action { |
| 1896 ProfileMetrics::LogProfileDesktopMenu(action, serviceType_); | 1900 ProfileMetrics::LogProfileDesktopMenu(action, serviceType_); |
| 1897 serviceType_ = signin::GAIA_SERVICE_TYPE_NONE; | 1901 serviceType_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 1898 } | 1902 } |
| 1899 | 1903 |
| 1900 @end | 1904 @end |
| OLD | NEW |