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

Side by Side Diff: trunk/src/chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 464673002: Revert 288817 "[Mac, Win] Only show the user manager tutorial if..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" 5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/first_run/first_run.h" 10 #include "chrome/browser/first_run/first_run.h"
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 666
667 void ProfileChooserView::ButtonPressed(views::Button* sender, 667 void ProfileChooserView::ButtonPressed(views::Button* sender,
668 const ui::Event& event) { 668 const ui::Event& event) {
669 // Disable button after clicking so that it doesn't get clicked twice and 669 // Disable button after clicking so that it doesn't get clicked twice and
670 // start a second action... which can crash Chrome. But don't disable if it 670 // start a second action... which can crash Chrome. But don't disable if it
671 // has no parent (like in tests) because that will also crash. 671 // has no parent (like in tests) because that will also crash.
672 if (sender->parent()) 672 if (sender->parent())
673 sender->SetEnabled(false); 673 sender->SetEnabled(false);
674 674
675 if (sender == users_button_) { 675 if (sender == users_button_) {
676 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile());
676 // If this is a guest session, also close all the guest browser windows. 677 // If this is a guest session, also close all the guest browser windows.
677 if (browser_->profile()->IsGuestSession()) { 678 if (browser_->profile()->IsGuestSession())
678 chrome::ShowUserManager(base::FilePath());
679 profiles::CloseGuestProfileWindows(); 679 profiles::CloseGuestProfileWindows();
680 } else {
681 chrome::ShowUserManager(browser_->profile()->GetPath());
682 }
683 } else if (sender == go_incognito_button_) { 680 } else if (sender == go_incognito_button_) {
684 DCHECK(ShouldShowGoIncognito()); 681 DCHECK(ShouldShowGoIncognito());
685 chrome::NewIncognitoWindow(browser_); 682 chrome::NewIncognitoWindow(browser_);
686 } else if (sender == lock_button_) { 683 } else if (sender == lock_button_) {
687 profiles::LockProfile(browser_->profile()); 684 profiles::LockProfile(browser_->profile());
688 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK); 685 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK);
689 } else if (sender == auth_error_email_button_) { 686 } else if (sender == auth_error_email_button_) {
690 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH, avatar_menu_.get()); 687 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH, avatar_menu_.get());
691 } else if (sender == tutorial_sync_settings_ok_button_) { 688 } else if (sender == tutorial_sync_settings_ok_button_) {
692 LoginUIServiceFactory::GetForProfile(browser_->profile())-> 689 LoginUIServiceFactory::GetForProfile(browser_->profile())->
(...skipping 19 matching lines...) Expand all
712 ShowView(account_management_available ? 709 ShowView(account_management_available ?
713 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT : 710 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT :
714 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); 711 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get());
715 } else if (current_profile_photo_ && 712 } else if (current_profile_photo_ &&
716 sender == current_profile_photo_->change_photo_button()) { 713 sender == current_profile_photo_->change_photo_button()) {
717 avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex()); 714 avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex());
718 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_EDIT_IMAGE); 715 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_EDIT_IMAGE);
719 } else if (sender == signin_current_profile_link_) { 716 } else if (sender == signin_current_profile_link_) {
720 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN, avatar_menu_.get()); 717 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN, avatar_menu_.get());
721 } else if (sender == add_person_button_) { 718 } else if (sender == add_person_button_) {
722 chrome::ShowUserManager(browser_->profile()->GetPath()); 719 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile());
723 } else if (sender == disconnect_button_) { 720 } else if (sender == disconnect_button_) {
724 chrome::ShowSettings(browser_); 721 chrome::ShowSettings(browser_);
725 } else if (sender == switch_user_cancel_button_) { 722 } else if (sender == switch_user_cancel_button_) {
726 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); 723 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get());
727 } else { 724 } else {
728 // Either one of the "other profiles", or one of the profile accounts 725 // Either one of the "other profiles", or one of the profile accounts
729 // buttons was pressed. 726 // buttons was pressed.
730 ButtonIndexes::const_iterator profile_match = 727 ButtonIndexes::const_iterator profile_match =
731 open_other_profile_indexes_map_.find(sender); 728 open_other_profile_indexes_map_.find(sender);
732 if (profile_match != open_other_profile_indexes_map_.end()) { 729 if (profile_match != open_other_profile_indexes_map_.end()) {
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 952
956 // Adds links and buttons. 953 // Adds links and buttons.
957 views::ColumnSet* button_columns = layout->AddColumnSet(1); 954 views::ColumnSet* button_columns = layout->AddColumnSet(1);
958 button_columns->AddColumn(views::GridLayout::LEADING, 955 button_columns->AddColumn(views::GridLayout::LEADING,
959 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); 956 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0);
960 button_columns->AddPaddingColumn( 957 button_columns->AddPaddingColumn(
961 1, views::kUnrelatedControlHorizontalSpacing); 958 1, views::kUnrelatedControlHorizontalSpacing);
962 button_columns->AddColumn(views::GridLayout::TRAILING, 959 button_columns->AddColumn(views::GridLayout::TRAILING,
963 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); 960 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0);
964 961
962 *link = CreateLink(link_text, this);
963 (*link)->SetHorizontalAlignment(gfx::ALIGN_LEFT);
964 (*link)->SetAutoColorReadabilityEnabled(false);
965 (*link)->SetEnabledColor(SK_ColorWHITE);
965 layout->StartRowWithPadding(1, 1, 0, views::kUnrelatedControlVerticalSpacing); 966 layout->StartRowWithPadding(1, 1, 0, views::kUnrelatedControlVerticalSpacing);
966 if (!link_text.empty()) { 967 layout->AddView(*link);
967 *link = CreateLink(link_text, this);
968 (*link)->SetHorizontalAlignment(gfx::ALIGN_LEFT);
969 (*link)->SetAutoColorReadabilityEnabled(false);
970 (*link)->SetEnabledColor(SK_ColorWHITE);
971 layout->AddView(*link);
972 } else {
973 layout->SkipColumns(1);
974 }
975 968
976 *button = new views::LabelButton(this, button_text); 969 *button = new views::LabelButton(this, button_text);
977 (*button)->SetHorizontalAlignment(gfx::ALIGN_CENTER); 970 (*button)->SetHorizontalAlignment(gfx::ALIGN_CENTER);
978 (*button)->SetStyle(views::Button::STYLE_BUTTON); 971 (*button)->SetStyle(views::Button::STYLE_BUTTON);
979 layout->AddView(*button); 972 layout->AddView(*button);
980 973
981 return view; 974 return view;
982 } 975 }
983 976
984 views::View* ProfileChooserView::CreateCurrentProfileView( 977 views::View* ProfileChooserView::CreateCurrentProfileView(
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 return TitleCard::AddPaddedTitleCard(view, title_card, 1387 return TitleCard::AddPaddedTitleCard(view, title_card,
1395 kFixedAccountRemovalViewWidth); 1388 kFixedAccountRemovalViewWidth);
1396 } 1389 }
1397 1390
1398 views::View* ProfileChooserView::CreateWelcomeUpgradeTutorialViewIfNeeded( 1391 views::View* ProfileChooserView::CreateWelcomeUpgradeTutorialViewIfNeeded(
1399 bool tutorial_shown, const AvatarMenu::Item& avatar_item){ 1392 bool tutorial_shown, const AvatarMenu::Item& avatar_item){
1400 if (first_run::IsChromeFirstRun()) 1393 if (first_run::IsChromeFirstRun())
1401 return NULL; 1394 return NULL;
1402 1395
1403 Profile* profile = browser_->profile(); 1396 Profile* profile = browser_->profile();
1397 if (!avatar_item.signed_in) {
1398 profile->GetPrefs()->SetInteger(
1399 prefs::kProfileAvatarTutorialShown, kUpgradeWelcomeTutorialShowMax + 1);
1400 return NULL;
1401 }
1404 1402
1405 const int show_count = profile->GetPrefs()->GetInteger( 1403 const int show_count = profile->GetPrefs()->GetInteger(
1406 prefs::kProfileAvatarTutorialShown); 1404 prefs::kProfileAvatarTutorialShown);
1407 // Do not show the tutorial if user has dismissed it. 1405 // Do not show the tutorial if user has dismissed it.
1408 if (show_count > kUpgradeWelcomeTutorialShowMax) 1406 if (show_count > kUpgradeWelcomeTutorialShowMax)
1409 return NULL; 1407 return NULL;
1410 1408
1411 if (!tutorial_shown) { 1409 if (!tutorial_shown) {
1412 if (show_count == kUpgradeWelcomeTutorialShowMax) 1410 if (show_count == kUpgradeWelcomeTutorialShowMax)
1413 return NULL; 1411 return NULL;
1414 profile->GetPrefs()->SetInteger( 1412 profile->GetPrefs()->SetInteger(
1415 prefs::kProfileAvatarTutorialShown, show_count + 1); 1413 prefs::kProfileAvatarTutorialShown, show_count + 1);
1416 } 1414 }
1417 1415
1418 // For local profiles, the "Not you" link doesn't make sense.
1419 base::string16 link_message = avatar_item.signed_in ?
1420 l10n_util::GetStringFUTF16(IDS_PROFILES_NOT_YOU, avatar_item.name) :
1421 base::string16();
1422
1423 return CreateTutorialView( 1416 return CreateTutorialView(
1424 profiles::TUTORIAL_MODE_WELCOME_UPGRADE, 1417 profiles::TUTORIAL_MODE_WELCOME_UPGRADE,
1425 l10n_util::GetStringFUTF16( 1418 l10n_util::GetStringFUTF16(
1426 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_TITLE, avatar_item.name), 1419 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_TITLE, avatar_item.name),
1427 l10n_util::GetStringUTF16( 1420 l10n_util::GetStringUTF16(
1428 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_CONTENT_TEXT), 1421 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_CONTENT_TEXT),
1429 link_message, 1422 l10n_util::GetStringFUTF16(
1423 IDS_PROFILES_NOT_YOU, avatar_item.name),
1430 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_WHATS_NEW_BUTTON), 1424 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_WHATS_NEW_BUTTON),
1431 &tutorial_not_you_link_, 1425 &tutorial_not_you_link_,
1432 &tutorial_see_whats_new_button_); 1426 &tutorial_see_whats_new_button_);
1433 } 1427 }
1434 1428
1435 views::View* ProfileChooserView::CreateSigninConfirmationView(){ 1429 views::View* ProfileChooserView::CreateSigninConfirmationView(){
1436 return CreateTutorialView( 1430 return CreateTutorialView(
1437 profiles::TUTORIAL_MODE_CONFIRM_SIGNIN, 1431 profiles::TUTORIAL_MODE_CONFIRM_SIGNIN,
1438 l10n_util::GetStringUTF16(IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_TITLE), 1432 l10n_util::GetStringUTF16(IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_TITLE),
1439 l10n_util::GetStringUTF16( 1433 l10n_util::GetStringUTF16(
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 1498 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1505 IncognitoModePrefs::DISABLED; 1499 IncognitoModePrefs::DISABLED;
1506 return incognito_available && !browser_->profile()->IsGuestSession(); 1500 return incognito_available && !browser_->profile()->IsGuestSession();
1507 } 1501 }
1508 1502
1509 void ProfileChooserView::PostActionPerformed( 1503 void ProfileChooserView::PostActionPerformed(
1510 ProfileMetrics::ProfileDesktopMenu action_performed) { 1504 ProfileMetrics::ProfileDesktopMenu action_performed) {
1511 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 1505 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
1512 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 1506 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
1513 } 1507 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698