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

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: Rebase Created 5 years, 7 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
« no previous file with comments | « chrome/browser/ui/views/profiles/profile_chooser_view.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 880cccd69e19eadfbfed252da534d046d3c3144b..3b414d20f291fa79b4d7a5c8840df9772cb9a545 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;
}
@@ -913,20 +913,7 @@ void ProfileChooserView::PopulateCompleteProfileChooserView(
item.signed_in && profiles::IsLockAvailable(browser_->profile()));
current_profile_view = CreateCurrentProfileView(item, false);
if (IsProfileChooser(view_mode_)) {
- switch (tutorial_mode_) {
- case profiles::TUTORIAL_MODE_NONE:
- case profiles::TUTORIAL_MODE_WELCOME_UPGRADE:
- tutorial_view = CreateWelcomeUpgradeTutorialViewIfNeeded(
- tutorial_mode_ == profiles::TUTORIAL_MODE_WELCOME_UPGRADE,
- item);
- break;
- case profiles::TUTORIAL_MODE_CONFIRM_SIGNIN:
- tutorial_view = CreateSigninConfirmationView();
- break;
- case profiles::TUTORIAL_MODE_SHOW_ERROR:
- tutorial_view = CreateSigninErrorView();
- break;
- }
+ tutorial_view = CreateTutorialViewIfNeeded(item);
} else {
current_profile_accounts = CreateCurrentProfileAccountsView(item);
}
@@ -1003,10 +990,15 @@ 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.
+ PrefService* local_state = g_browser_process->local_state();
+ local_state->SetBoolean(
+ prefs::kProfileAvatarRightClickTutorialDismissed, true);
+ } else {
PopulateCompleteProfileChooserView(layout, avatar_menu);
+ }
return view;
}
@@ -1019,10 +1011,43 @@ void ProfileChooserView::DismissTutorial() {
signin_ui_util::kUpgradeWelcomeTutorialShowMax + 1);
}
+ if (tutorial_mode_ == profiles::TUTORIAL_MODE_RIGHT_CLICK_SWITCHING) {
+ PrefService* local_state = g_browser_process->local_state();
+ local_state->SetBoolean(
+ prefs::kProfileAvatarRightClickTutorialDismissed, true);
+ }
+
tutorial_mode_ = profiles::TUTORIAL_MODE_NONE;
ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get());
}
+views::View* ProfileChooserView::CreateTutorialViewIfNeeded(
+ const AvatarMenu::Item& item) {
+ if (tutorial_mode_ == profiles::TUTORIAL_MODE_CONFIRM_SIGNIN)
+ return CreateSigninConfirmationView();
+
+ if (tutorial_mode_ == profiles::TUTORIAL_MODE_SHOW_ERROR)
+ return CreateSigninErrorView();
+
+ if (profiles::ShouldShowWelcomeUpgradeTutorial(
+ browser_->profile(), tutorial_mode_)) {
+ if (tutorial_mode_ != profiles::TUTORIAL_MODE_WELCOME_UPGRADE) {
+ Profile* profile = browser_->profile();
+ const int show_count = profile->GetPrefs()->GetInteger(
+ prefs::kProfileAvatarTutorialShown);
+ profile->GetPrefs()->SetInteger(
+ prefs::kProfileAvatarTutorialShown, show_count + 1);
+ }
+
+ return CreateWelcomeUpgradeTutorialView(item);
+ }
+
+ if (profiles::ShouldShowRightClickTutorial(browser_->profile()))
+ return CreateRightClickTutorialView();
+
+ return nullptr;
+}
+
views::View* ProfileChooserView::CreateTutorialView(
profiles::TutorialMode tutorial_mode,
const base::string16& title_text,
@@ -1572,22 +1597,8 @@ views::View* ProfileChooserView::CreateAccountRemovalView() {
kFixedAccountRemovalViewWidth);
}
-views::View* ProfileChooserView::CreateWelcomeUpgradeTutorialViewIfNeeded(
- bool tutorial_shown, const AvatarMenu::Item& avatar_item) {
- Profile* profile = browser_->profile();
-
- const int show_count = profile->GetPrefs()->GetInteger(
- prefs::kProfileAvatarTutorialShown);
- // Do not show the tutorial if user has dismissed it.
- if (show_count > signin_ui_util::kUpgradeWelcomeTutorialShowMax)
- return NULL;
-
- if (!tutorial_shown) {
- if (show_count == signin_ui_util::kUpgradeWelcomeTutorialShowMax)
- return NULL;
- profile->GetPrefs()->SetInteger(
- prefs::kProfileAvatarTutorialShown, show_count + 1);
- }
+views::View* ProfileChooserView::CreateWelcomeUpgradeTutorialView(
+ const AvatarMenu::Item& avatar_item) {
ProfileMetrics::LogProfileNewAvatarMenuUpgrade(
ProfileMetrics::PROFILE_AVATAR_MENU_UPGRADE_VIEW);
@@ -1643,6 +1654,19 @@ views::View* ProfileChooserView::CreateSigninErrorView() {
&tutorial_close_button_);
}
+views::View* ProfileChooserView::CreateRightClickTutorialView() {
+ 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(
« no previous file with comments | « chrome/browser/ui/views/profiles/profile_chooser_view.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698