Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(975)

Unified Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 1120013003: Add right-click user switching tutorial bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make the pref per-chrome instead of per-profile. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/profiles/profile_chooser_view.cc
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
index f55258026ec657bf0ba3466211ae3fa8ea3bc099..b234b60f74f38e93701838879f631660fd30ab4b 100644
--- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc
+++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
@@ -491,7 +491,7 @@ void ProfileChooserView::ShowBubble(
// It has to happen here to prevent the view system from creating an empty
// container.
if (view_mode == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER &&
- profiles::HasProfileSwitchTargets(browser->profile())) {
+ !profiles::HasProfileSwitchTargets(browser->profile())) {
return;
}
@@ -916,9 +916,12 @@ void ProfileChooserView::PopulateCompleteProfileChooserView(
switch (tutorial_mode_) {
case profiles::TUTORIAL_MODE_NONE:
case profiles::TUTORIAL_MODE_WELCOME_UPGRADE:
+ case profiles::TUTORIAL_MODE_RIGHT_CLICK_SWITCHING:
tutorial_view = CreateWelcomeUpgradeTutorialViewIfNeeded(
tutorial_mode_ == profiles::TUTORIAL_MODE_WELCOME_UPGRADE,
item);
+ if (!tutorial_view)
Mike Lerman 2015/05/05 01:31:45 I understand what you're doing here, but the contr
anthonyvd 2015/05/05 16:19:17 Very good point, here's a small refactor :) Let me
Mike Lerman 2015/05/05 17:18:09 I love it! Thanks!
+ tutorial_view = CreateRightClickTutorialViewIfNeeded();
break;
case profiles::TUTORIAL_MODE_CONFIRM_SIGNIN:
tutorial_view = CreateSigninConfirmationView();
@@ -1003,10 +1006,13 @@ views::View* ProfileChooserView::CreateProfileChooserView(
views::View* view = new views::View();
views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth);
- if (view_mode_ == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER)
+ if (view_mode_ == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER) {
PopulateMinimalProfileChooserView(layout, avatar_menu);
- else
+ // The user is using right-click switching, no need to tell them about it.
+ profiles::SetFastUserSwitchingTutorialDismissedState(true);
+ } else {
PopulateCompleteProfileChooserView(layout, avatar_menu);
+ }
return view;
}
@@ -1019,6 +1025,10 @@ void ProfileChooserView::DismissTutorial() {
signin_ui_util::kUpgradeWelcomeTutorialShowMax + 1);
}
+ if (tutorial_mode_ == profiles::TUTORIAL_MODE_RIGHT_CLICK_SWITCHING) {
+ profiles::SetFastUserSwitchingTutorialDismissedState(true);
+ }
+
tutorial_mode_ = profiles::TUTORIAL_MODE_NONE;
ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get());
}
@@ -1643,6 +1653,26 @@ views::View* ProfileChooserView::CreateSigninErrorView() {
&tutorial_close_button_);
}
+views::View* ProfileChooserView::CreateRightClickTutorialViewIfNeeded() {
+ 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 nullptr;
+
+ return CreateTutorialView(
+ profiles::TUTORIAL_MODE_RIGHT_CLICK_SWITCHING,
+ l10n_util::GetStringUTF16(IDS_PROFILES_RIGHT_CLICK_TUTORIAL_TITLE),
+ l10n_util::GetStringUTF16(IDS_PROFILES_RIGHT_CLICK_TUTORIAL_CONTENT_TEXT),
+ base::string16(),
+ l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_OK_BUTTON),
+ false,
+ nullptr,
+ &tutorial_sync_settings_ok_button_,
+ nullptr);
+}
+
views::View* ProfileChooserView::CreateSwitchUserView() {
views::View* view = new views::View();
views::GridLayout* layout = CreateSingleColumnLayout(

Powered by Google App Engine
This is Rietveld 408576698