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

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

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

Powered by Google App Engine
This is Rietveld 408576698