Chromium Code Reviews| Index: chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm |
| diff --git a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm |
| index 29afe4656c062367f0de181eae0430a6f5dd7c9a..a7f845b5d36fcb07c30921ed21ad22128165d9e7 100644 |
| --- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm |
| +++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm |
| @@ -899,6 +899,10 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| // the previous active view. |avatar_item| refers to the current profile. |
| - (NSView*)buildWelcomeUpgradeTutorialViewIfNeeded; |
| +// Builds a tutorial card to inform the user about right-click user switching if |
| +// needed. |
| +- (NSView*)buildRightClickTutorialViewIfNeeded; |
| + |
| // Builds a tutorial card to have the user confirm the last Chrome signin, |
| // Chrome sync will be delayed until the user either dismisses the tutorial, or |
| // configures sync through the "Settings" link. |
| @@ -1129,6 +1133,10 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| signin_ui_util::kUpgradeWelcomeTutorialShowMax + 1); |
| } |
| + if(tutorialMode_ == profiles::TUTORIAL_MODE_RIGHT_CLICK_SWITCHING) { |
| + profiles::SetFastUserSwitchingTutorialDismissedState(true); |
| + } |
| + |
| tutorialMode_ = profiles::TUTORIAL_MODE_NONE; |
| [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; |
| } |
| @@ -1270,6 +1278,10 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| bool displayLock = false; |
| bool isFastProfileChooser = |
| viewMode_ == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER; |
| + if (isFastProfileChooser) { |
|
Mike Lerman
2015/05/05 01:31:45
nit: inline the condition.
anthonyvd
2015/05/05 16:19:17
It's used again a little further down.
|
| + // The user is using right-click switching, no need to tell them about it. |
| + profiles::SetFastUserSwitchingTutorialDismissedState(true); |
| + } |
| // Loop over the profiles in reverse, so that they are sorted by their |
| // y-coordinate, and separate them into active and "other" profiles. |
| @@ -1280,8 +1292,11 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| switch (tutorialMode_) { |
| case profiles::TUTORIAL_MODE_NONE: |
| case profiles::TUTORIAL_MODE_WELCOME_UPGRADE: |
| + case profiles::TUTORIAL_MODE_RIGHT_CLICK_SWITCHING: |
| tutorialView = |
| [self buildWelcomeUpgradeTutorialViewIfNeeded]; |
| + if (!tutorialView) |
| + tutorialView = [self buildRightClickTutorialViewIfNeeded]; |
| break; |
| case profiles::TUTORIAL_MODE_CONFIRM_SIGNIN: |
| tutorialView = [self buildSigninConfirmationView]; |
| @@ -1469,6 +1484,33 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, |
| buttonAction:@selector(seeWhatsNew:)]; |
| } |
| +- (NSView*)buildRightClickTutorialViewIfNeeded { |
| + const bool dismissed = profiles::GetFastUserSwitchingTutorialDismissedState(); |
| + |
| + // Don't show the tutorial if it's already been dismissed for this profile or |
| + // if right-clicking wouldn't show any targets. |
| + if (dismissed || !profiles::HasProfileSwitchTargets(browser_->profile())) |
| + return nil; |
| + |
| + NSString* titleMessage = l10n_util::GetNSString( |
| + IDS_PROFILES_RIGHT_CLICK_TUTORIAL_TITLE); |
| + NSString* contentMessage = l10n_util::GetNSString( |
| + IDS_PROFILES_RIGHT_CLICK_TUTORIAL_CONTENT_TEXT); |
| + NSString* buttonMessage = l10n_util::GetNSString( |
| + IDS_PROFILES_TUTORIAL_OK_BUTTON); |
| + |
| + return |
| + [self tutorialViewWithMode:profiles::TUTORIAL_MODE_RIGHT_CLICK_SWITCHING |
| + titleMessage:titleMessage |
| + contentMessage:contentMessage |
| + linkMessage:nil |
| + buttonMessage:buttonMessage |
| + stackButton:NO |
| + hasCloseButton:NO |
| + linkAction:nil |
| + buttonAction:@selector(dismissTutorial:)]; |
| +} |
| + |
| - (NSView*)tutorialViewWithMode:(profiles::TutorialMode)mode |
| titleMessage:(NSString*)titleMessage |
| contentMessage:(NSString*)contentMessage |