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 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 buttonAction:(SEL)buttonAction; | 975 buttonAction:(SEL)buttonAction; |
976 | 976 |
977 // Builds a header for signin and sync error surfacing on the user menu. | 977 // Builds a header for signin and sync error surfacing on the user menu. |
978 - (NSView*)buildSyncErrorViewIfNeeded; | 978 - (NSView*)buildSyncErrorViewIfNeeded; |
979 | 979 |
980 // Builds a tutorial card to introduce an upgrade user to the new avatar menu if | 980 // Builds a tutorial card to introduce an upgrade user to the new avatar menu if |
981 // needed. |tutorial_shown| indicates if the tutorial has already been shown in | 981 // needed. |tutorial_shown| indicates if the tutorial has already been shown in |
982 // the previous active view. |avatar_item| refers to the current profile. | 982 // the previous active view. |avatar_item| refers to the current profile. |
983 - (NSView*)buildWelcomeUpgradeTutorialView:(const AvatarMenu::Item&)item; | 983 - (NSView*)buildWelcomeUpgradeTutorialView:(const AvatarMenu::Item&)item; |
984 | 984 |
985 // Builds a tutorial card to inform the user about right-click user switching if | |
986 // needed. | |
987 - (NSView*)buildRightClickTutorialView; | |
988 | |
989 // Builds a tutorial card to have the user confirm the last Chrome signin, | 985 // Builds a tutorial card to have the user confirm the last Chrome signin, |
990 // Chrome sync will be delayed until the user either dismisses the tutorial, or | 986 // Chrome sync will be delayed until the user either dismisses the tutorial, or |
991 // configures sync through the "Settings" link. | 987 // configures sync through the "Settings" link. |
992 - (NSView*)buildSigninConfirmationView; | 988 - (NSView*)buildSigninConfirmationView; |
993 | 989 |
994 // Builds a tutorial card to show the last signin error. | 990 // Builds a tutorial card to show the last signin error. |
995 - (NSView*)buildSigninErrorView; | 991 - (NSView*)buildSigninErrorView; |
996 | 992 |
997 // Creates the main profile card for the profile |item| at the top of | 993 // Creates the main profile card for the profile |item| at the top of |
998 // the bubble. | 994 // the bubble. |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 } | 1260 } |
1265 | 1261 |
1266 - (IBAction)dismissTutorial:(id)sender { | 1262 - (IBAction)dismissTutorial:(id)sender { |
1267 // Never shows the upgrade tutorial again if manually closed. | 1263 // Never shows the upgrade tutorial again if manually closed. |
1268 if (tutorialMode_ == profiles::TUTORIAL_MODE_WELCOME_UPGRADE) { | 1264 if (tutorialMode_ == profiles::TUTORIAL_MODE_WELCOME_UPGRADE) { |
1269 browser_->profile()->GetPrefs()->SetInteger( | 1265 browser_->profile()->GetPrefs()->SetInteger( |
1270 prefs::kProfileAvatarTutorialShown, | 1266 prefs::kProfileAvatarTutorialShown, |
1271 signin_ui_util::kUpgradeWelcomeTutorialShowMax + 1); | 1267 signin_ui_util::kUpgradeWelcomeTutorialShowMax + 1); |
1272 } | 1268 } |
1273 | 1269 |
1274 if(tutorialMode_ == profiles::TUTORIAL_MODE_RIGHT_CLICK_SWITCHING) { | |
1275 PrefService* localState = g_browser_process->local_state(); | |
1276 localState->SetBoolean( | |
1277 prefs::kProfileAvatarRightClickTutorialDismissed, true); | |
1278 } | |
1279 | |
1280 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; | 1270 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; |
1281 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; | 1271 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; |
1282 } | 1272 } |
1283 | 1273 |
1284 - (void)windowWillClose:(NSNotification*)notification { | 1274 - (void)windowWillClose:(NSNotification*)notification { |
1285 if (tutorialMode_ == profiles::TUTORIAL_MODE_CONFIRM_SIGNIN) { | 1275 if (tutorialMode_ == profiles::TUTORIAL_MODE_CONFIRM_SIGNIN) { |
1286 LoginUIServiceFactory::GetForProfile(browser_->profile())-> | 1276 LoginUIServiceFactory::GetForProfile(browser_->profile())-> |
1287 SyncConfirmationUIClosed(LoginUIService::SYNC_WITH_DEFAULT_SETTINGS); | 1277 SyncConfirmationUIClosed(LoginUIService::SYNC_WITH_DEFAULT_SETTINGS); |
1288 } | 1278 } |
1289 | 1279 |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 titleMessage:titleMessage | 1619 titleMessage:titleMessage |
1630 contentMessage:contentMessage | 1620 contentMessage:contentMessage |
1631 linkMessage:linkMessage | 1621 linkMessage:linkMessage |
1632 buttonMessage:buttonMessage | 1622 buttonMessage:buttonMessage |
1633 stackButton:YES | 1623 stackButton:YES |
1634 hasCloseButton:YES | 1624 hasCloseButton:YES |
1635 linkAction:@selector(showSwitchUserView:) | 1625 linkAction:@selector(showSwitchUserView:) |
1636 buttonAction:@selector(seeWhatsNew:)]; | 1626 buttonAction:@selector(seeWhatsNew:)]; |
1637 } | 1627 } |
1638 | 1628 |
1639 - (NSView*)buildRightClickTutorialView { | |
1640 NSString* titleMessage = l10n_util::GetNSString( | |
1641 IDS_PROFILES_RIGHT_CLICK_TUTORIAL_TITLE); | |
1642 NSString* contentMessage = l10n_util::GetNSString( | |
1643 IDS_PROFILES_RIGHT_CLICK_TUTORIAL_CONTENT_TEXT); | |
1644 NSString* buttonMessage = l10n_util::GetNSString( | |
1645 IDS_PROFILES_TUTORIAL_OK_BUTTON); | |
1646 | |
1647 return | |
1648 [self tutorialViewWithMode:profiles::TUTORIAL_MODE_RIGHT_CLICK_SWITCHING | |
1649 titleMessage:titleMessage | |
1650 contentMessage:contentMessage | |
1651 linkMessage:nil | |
1652 buttonMessage:buttonMessage | |
1653 stackButton:NO | |
1654 hasCloseButton:NO | |
1655 linkAction:nil | |
1656 buttonAction:@selector(dismissTutorial:)]; | |
1657 } | |
1658 | |
1659 - (NSView*)tutorialViewWithMode:(profiles::TutorialMode)mode | 1629 - (NSView*)tutorialViewWithMode:(profiles::TutorialMode)mode |
1660 titleMessage:(NSString*)titleMessage | 1630 titleMessage:(NSString*)titleMessage |
1661 contentMessage:(NSString*)contentMessage | 1631 contentMessage:(NSString*)contentMessage |
1662 linkMessage:(NSString*)linkMessage | 1632 linkMessage:(NSString*)linkMessage |
1663 buttonMessage:(NSString*)buttonMessage | 1633 buttonMessage:(NSString*)buttonMessage |
1664 stackButton:(BOOL)stackButton | 1634 stackButton:(BOOL)stackButton |
1665 hasCloseButton:(BOOL)hasCloseButton | 1635 hasCloseButton:(BOOL)hasCloseButton |
1666 linkAction:(SEL)linkAction | 1636 linkAction:(SEL)linkAction |
1667 buttonAction:(SEL)buttonAction { | 1637 buttonAction:(SEL)buttonAction { |
1668 tutorialMode_ = mode; | 1638 tutorialMode_ = mode; |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2676 | 2646 |
2677 - (void)showWindow:(id)sender { | 2647 - (void)showWindow:(id)sender { |
2678 [super showWindow:sender]; | 2648 [super showWindow:sender]; |
2679 NSEvent *event = [[NSApplication sharedApplication] currentEvent]; | 2649 NSEvent *event = [[NSApplication sharedApplication] currentEvent]; |
2680 if (firstProfileView_ && [event type] == NSKeyDown) { | 2650 if (firstProfileView_ && [event type] == NSKeyDown) { |
2681 [[self window] makeFirstResponder:firstProfileView_]; | 2651 [[self window] makeFirstResponder:firstProfileView_]; |
2682 } | 2652 } |
2683 } | 2653 } |
2684 | 2654 |
2685 @end | 2655 @end |
OLD | NEW |