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 #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/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 layout = CreateSingleColumnLayout(this, kFixedGaiaViewWidth); | 632 layout = CreateSingleColumnLayout(this, kFixedGaiaViewWidth); |
633 sub_view = CreateGaiaSigninView(); | 633 sub_view = CreateGaiaSigninView(); |
634 break; | 634 break; |
635 case profiles::BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL: | 635 case profiles::BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL: |
636 layout = CreateSingleColumnLayout(this, kFixedAccountRemovalViewWidth); | 636 layout = CreateSingleColumnLayout(this, kFixedAccountRemovalViewWidth); |
637 sub_view = CreateAccountRemovalView(); | 637 sub_view = CreateAccountRemovalView(); |
638 break; | 638 break; |
639 case profiles::BUBBLE_VIEW_MODE_SWITCH_USER: | 639 case profiles::BUBBLE_VIEW_MODE_SWITCH_USER: |
640 layout = CreateSingleColumnLayout(this, kFixedSwitchUserViewWidth); | 640 layout = CreateSingleColumnLayout(this, kFixedSwitchUserViewWidth); |
641 sub_view = CreateSwitchUserView(); | 641 sub_view = CreateSwitchUserView(); |
| 642 ProfileMetrics::LogProfileNewAvatarMenuNotYou( |
| 643 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_VIEW); |
642 break; | 644 break; |
643 default: | 645 default: |
644 layout = CreateSingleColumnLayout(this, kFixedMenuWidth); | 646 layout = CreateSingleColumnLayout(this, kFixedMenuWidth); |
645 sub_view = CreateProfileChooserView(avatar_menu, last_tutorial_mode); | 647 sub_view = CreateProfileChooserView(avatar_menu, last_tutorial_mode); |
646 } | 648 } |
647 layout->StartRow(1, 0); | 649 layout->StartRow(1, 0); |
648 layout->AddView(sub_view); | 650 layout->AddView(sub_view); |
649 Layout(); | 651 Layout(); |
650 if (GetBubbleFrameView()) | 652 if (GetBubbleFrameView()) |
651 SizeToContents(); | 653 SizeToContents(); |
(...skipping 28 matching lines...) Expand all Loading... |
680 } else if (sender == lock_button_) { | 682 } else if (sender == lock_button_) { |
681 profiles::LockProfile(browser_->profile()); | 683 profiles::LockProfile(browser_->profile()); |
682 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK); | 684 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK); |
683 } else if (sender == auth_error_email_button_) { | 685 } else if (sender == auth_error_email_button_) { |
684 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH, avatar_menu_.get()); | 686 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH, avatar_menu_.get()); |
685 } else if (sender == tutorial_sync_settings_ok_button_) { | 687 } else if (sender == tutorial_sync_settings_ok_button_) { |
686 LoginUIServiceFactory::GetForProfile(browser_->profile())-> | 688 LoginUIServiceFactory::GetForProfile(browser_->profile())-> |
687 SyncConfirmationUIClosed(false /* configure_sync_first */); | 689 SyncConfirmationUIClosed(false /* configure_sync_first */); |
688 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE; | 690 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE; |
689 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); | 691 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); |
| 692 ProfileMetrics::LogProfileNewAvatarMenuSignin( |
| 693 ProfileMetrics::PROFILE_AVATAR_MENU_SIGNIN_OK); |
690 } else if (sender == tutorial_see_whats_new_button_) { | 694 } else if (sender == tutorial_see_whats_new_button_) { |
| 695 ProfileMetrics::LogProfileNewAvatarMenuUpgrade( |
| 696 ProfileMetrics::PROFILE_AVATAR_MENU_UPGRADE_WHATS_NEW); |
691 chrome::ShowUserManagerWithTutorial( | 697 chrome::ShowUserManagerWithTutorial( |
692 profiles::USER_MANAGER_TUTORIAL_OVERVIEW); | 698 profiles::USER_MANAGER_TUTORIAL_OVERVIEW); |
693 } else if (sender == remove_account_button_) { | 699 } else if (sender == remove_account_button_) { |
694 RemoveAccount(); | 700 RemoveAccount(); |
695 } else if (sender == account_removal_cancel_button_) { | 701 } else if (sender == account_removal_cancel_button_) { |
696 account_id_to_remove_.clear(); | 702 account_id_to_remove_.clear(); |
697 ShowView(profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); | 703 ShowView(profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); |
698 } else if (sender == gaia_signin_cancel_button_) { | 704 } else if (sender == gaia_signin_cancel_button_) { |
699 std::string primary_account = | 705 std::string primary_account = |
700 SigninManagerFactory::GetForProfile(browser_->profile())-> | 706 SigninManagerFactory::GetForProfile(browser_->profile())-> |
701 GetAuthenticatedUsername(); | 707 GetAuthenticatedUsername(); |
702 // The account management view is only available with the | 708 // The account management view is only available with the |
703 // --enable-account-consistency flag. | 709 // --enable-account-consistency flag. |
704 bool account_management_available = !primary_account.empty() && | 710 bool account_management_available = !primary_account.empty() && |
705 switches::IsEnableAccountConsistency(); | 711 switches::IsEnableAccountConsistency(); |
706 ShowView(account_management_available ? | 712 ShowView(account_management_available ? |
707 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT : | 713 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT : |
708 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); | 714 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); |
709 } else if (current_profile_photo_ && | 715 } else if (current_profile_photo_ && |
710 sender == current_profile_photo_->change_photo_button()) { | 716 sender == current_profile_photo_->change_photo_button()) { |
711 avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex()); | 717 avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex()); |
712 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_EDIT_IMAGE); | 718 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_EDIT_IMAGE); |
713 } else if (sender == signin_current_profile_link_) { | 719 } else if (sender == signin_current_profile_link_) { |
714 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN, avatar_menu_.get()); | 720 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN, avatar_menu_.get()); |
715 } else if (sender == add_person_button_) { | 721 } else if (sender == add_person_button_) { |
| 722 ProfileMetrics::LogProfileNewAvatarMenuNotYou( |
| 723 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_ADD_PERSON); |
716 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile()); | 724 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile()); |
717 } else if (sender == disconnect_button_) { | 725 } else if (sender == disconnect_button_) { |
| 726 ProfileMetrics::LogProfileNewAvatarMenuNotYou( |
| 727 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_DISCONNECT); |
718 chrome::ShowSettings(browser_); | 728 chrome::ShowSettings(browser_); |
719 } else if (sender == switch_user_cancel_button_) { | 729 } else if (sender == switch_user_cancel_button_) { |
720 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); | 730 ShowView(profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); |
| 731 ProfileMetrics::LogProfileNewAvatarMenuNotYou( |
| 732 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_BACK); |
721 } else { | 733 } else { |
722 // Either one of the "other profiles", or one of the profile accounts | 734 // Either one of the "other profiles", or one of the profile accounts |
723 // buttons was pressed. | 735 // buttons was pressed. |
724 ButtonIndexes::const_iterator profile_match = | 736 ButtonIndexes::const_iterator profile_match = |
725 open_other_profile_indexes_map_.find(sender); | 737 open_other_profile_indexes_map_.find(sender); |
726 if (profile_match != open_other_profile_indexes_map_.end()) { | 738 if (profile_match != open_other_profile_indexes_map_.end()) { |
727 avatar_menu_->SwitchToProfile( | 739 avatar_menu_->SwitchToProfile( |
728 profile_match->second, | 740 profile_match->second, |
729 ui::DispositionFromEventFlags(event.flags()) == NEW_WINDOW, | 741 ui::DispositionFromEventFlags(event.flags()) == NEW_WINDOW, |
730 ProfileMetrics::SWITCH_PROFILE_ICON); | 742 ProfileMetrics::SWITCH_PROFILE_ICON); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER : | 781 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER : |
770 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, | 782 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, |
771 avatar_menu_.get()); | 783 avatar_menu_.get()); |
772 } else if (sender == add_account_link_) { | 784 } else if (sender == add_account_link_) { |
773 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT, avatar_menu_.get()); | 785 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT, avatar_menu_.get()); |
774 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_ADD_ACCT); | 786 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_ADD_ACCT); |
775 } else if (sender == tutorial_sync_settings_link_) { | 787 } else if (sender == tutorial_sync_settings_link_) { |
776 LoginUIServiceFactory::GetForProfile(browser_->profile())-> | 788 LoginUIServiceFactory::GetForProfile(browser_->profile())-> |
777 SyncConfirmationUIClosed(true /* configure_sync_first */); | 789 SyncConfirmationUIClosed(true /* configure_sync_first */); |
778 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE; | 790 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE; |
| 791 ProfileMetrics::LogProfileNewAvatarMenuSignin( |
| 792 ProfileMetrics::PROFILE_AVATAR_MENU_SIGNIN_SETTINGS); |
779 } else { | 793 } else { |
780 DCHECK(sender == tutorial_not_you_link_); | 794 DCHECK(sender == tutorial_not_you_link_); |
| 795 ProfileMetrics::LogProfileNewAvatarMenuUpgrade( |
| 796 ProfileMetrics::PROFILE_AVATAR_MENU_UPGRADE_NOT_YOU); |
781 ShowView(profiles::BUBBLE_VIEW_MODE_SWITCH_USER, avatar_menu_.get()); | 797 ShowView(profiles::BUBBLE_VIEW_MODE_SWITCH_USER, avatar_menu_.get()); |
782 } | 798 } |
783 } | 799 } |
784 | 800 |
785 void ProfileChooserView::StyledLabelLinkClicked( | 801 void ProfileChooserView::StyledLabelLinkClicked( |
786 const gfx::Range& range, int event_flags) { | 802 const gfx::Range& range, int event_flags) { |
787 chrome::ShowSettings(browser_); | 803 chrome::ShowSettings(browser_); |
788 } | 804 } |
789 | 805 |
790 bool ProfileChooserView::HandleKeyEvent(views::Textfield* sender, | 806 bool ProfileChooserView::HandleKeyEvent(views::Textfield* sender, |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1400 if (show_count > signin_ui_util::kUpgradeWelcomeTutorialShowMax) | 1416 if (show_count > signin_ui_util::kUpgradeWelcomeTutorialShowMax) |
1401 return NULL; | 1417 return NULL; |
1402 | 1418 |
1403 if (!tutorial_shown) { | 1419 if (!tutorial_shown) { |
1404 if (show_count == signin_ui_util::kUpgradeWelcomeTutorialShowMax) | 1420 if (show_count == signin_ui_util::kUpgradeWelcomeTutorialShowMax) |
1405 return NULL; | 1421 return NULL; |
1406 profile->GetPrefs()->SetInteger( | 1422 profile->GetPrefs()->SetInteger( |
1407 prefs::kProfileAvatarTutorialShown, show_count + 1); | 1423 prefs::kProfileAvatarTutorialShown, show_count + 1); |
1408 } | 1424 } |
1409 | 1425 |
| 1426 ProfileMetrics::LogProfileNewAvatarMenuUpgrade( |
| 1427 ProfileMetrics::PROFILE_AVATAR_MENU_UPGRADE_VIEW); |
| 1428 |
1410 return CreateTutorialView( | 1429 return CreateTutorialView( |
1411 profiles::TUTORIAL_MODE_WELCOME_UPGRADE, | 1430 profiles::TUTORIAL_MODE_WELCOME_UPGRADE, |
1412 l10n_util::GetStringUTF16( | 1431 l10n_util::GetStringUTF16( |
1413 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_TITLE), | 1432 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_TITLE), |
1414 l10n_util::GetStringUTF16( | 1433 l10n_util::GetStringUTF16( |
1415 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_CONTENT_TEXT), | 1434 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_CONTENT_TEXT), |
1416 l10n_util::GetStringFUTF16( | 1435 l10n_util::GetStringFUTF16( |
1417 IDS_PROFILES_NOT_YOU, avatar_item.name), | 1436 IDS_PROFILES_NOT_YOU, avatar_item.name), |
1418 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_WHATS_NEW_BUTTON), | 1437 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_WHATS_NEW_BUTTON), |
1419 &tutorial_not_you_link_, | 1438 &tutorial_not_you_link_, |
1420 &tutorial_see_whats_new_button_); | 1439 &tutorial_see_whats_new_button_); |
1421 } | 1440 } |
1422 | 1441 |
1423 views::View* ProfileChooserView::CreateSigninConfirmationView(){ | 1442 views::View* ProfileChooserView::CreateSigninConfirmationView(){ |
| 1443 ProfileMetrics::LogProfileNewAvatarMenuSignin( |
| 1444 ProfileMetrics::PROFILE_AVATAR_MENU_SIGNIN_VIEW); |
| 1445 |
1424 return CreateTutorialView( | 1446 return CreateTutorialView( |
1425 profiles::TUTORIAL_MODE_CONFIRM_SIGNIN, | 1447 profiles::TUTORIAL_MODE_CONFIRM_SIGNIN, |
1426 l10n_util::GetStringUTF16(IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_TITLE), | 1448 l10n_util::GetStringUTF16(IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_TITLE), |
1427 l10n_util::GetStringUTF16( | 1449 l10n_util::GetStringUTF16( |
1428 IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_CONTENT_TEXT), | 1450 IDS_PROFILES_CONFIRM_SIGNIN_TUTORIAL_CONTENT_TEXT), |
1429 l10n_util::GetStringUTF16(IDS_PROFILES_SYNC_SETTINGS_LINK), | 1451 l10n_util::GetStringUTF16(IDS_PROFILES_SYNC_SETTINGS_LINK), |
1430 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_OK_BUTTON), | 1452 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_OK_BUTTON), |
1431 &tutorial_sync_settings_link_, | 1453 &tutorial_sync_settings_link_, |
1432 &tutorial_sync_settings_ok_button_); | 1454 &tutorial_sync_settings_ok_button_); |
1433 } | 1455 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1515 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
1494 IncognitoModePrefs::DISABLED; | 1516 IncognitoModePrefs::DISABLED; |
1495 return incognito_available && !browser_->profile()->IsGuestSession(); | 1517 return incognito_available && !browser_->profile()->IsGuestSession(); |
1496 } | 1518 } |
1497 | 1519 |
1498 void ProfileChooserView::PostActionPerformed( | 1520 void ProfileChooserView::PostActionPerformed( |
1499 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1521 ProfileMetrics::ProfileDesktopMenu action_performed) { |
1500 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1522 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
1501 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1523 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
1502 } | 1524 } |
OLD | NEW |