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

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

Issue 227083007: UMA for New Profile Management. Track User-Menu Tutorial actions with Histograms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits and update for unit tests; update histograms.xml Created 6 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 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/lifetime/application_lifetime.h" 10 #include "chrome/browser/lifetime/application_lifetime.h"
11 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 11 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
12 #include "chrome/browser/profiles/profile_info_cache.h" 12 #include "chrome/browser/profiles/profile_info_cache.h"
13 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/profiles/profile_metrics.h"
14 #include "chrome/browser/profiles/profile_window.h" 15 #include "chrome/browser/profiles/profile_window.h"
15 #include "chrome/browser/profiles/profiles_state.h" 16 #include "chrome/browser/profiles/profiles_state.h"
16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
17 #include "chrome/browser/signin/signin_manager_factory.h" 18 #include "chrome/browser/signin/signin_manager_factory.h"
18 #include "chrome/browser/signin/signin_promo.h" 19 #include "chrome/browser/signin/signin_promo.h"
19 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
20 #include "chrome/browser/ui/browser_dialogs.h" 21 #include "chrome/browser/ui/browser_dialogs.h"
21 #include "chrome/browser/ui/chrome_pages.h" 22 #include "chrome/browser/ui/chrome_pages.h"
22 #include "chrome/browser/ui/singleton_tabs.h" 23 #include "chrome/browser/ui/singleton_tabs.h"
23 #include "chrome/browser/ui/views/profiles/user_manager_view.h" 24 #include "chrome/browser/ui/views/profiles/user_manager_view.h"
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile()); 523 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile());
523 } else if (sender == lock_button_) { 524 } else if (sender == lock_button_) {
524 profiles::LockProfile(browser_->profile()); 525 profiles::LockProfile(browser_->profile());
525 } else if (sender == tutorial_ok_button_) { 526 } else if (sender == tutorial_ok_button_) {
526 // If the user manually dismissed the tutorial, never show it again by 527 // If the user manually dismissed the tutorial, never show it again by
527 // setting the number of times shown to the maximum plus 1, so that later we 528 // setting the number of times shown to the maximum plus 1, so that later we
528 // could distinguish between the dismiss case and the case when the tutorial 529 // could distinguish between the dismiss case and the case when the tutorial
529 // is indeed shown for the maximum number of times. 530 // is indeed shown for the maximum number of times.
530 browser_->profile()->GetPrefs()->SetInteger( 531 browser_->profile()->GetPrefs()->SetInteger(
531 prefs::kProfileAvatarTutorialShown, kProfileAvatarTutorialShowMax + 1); 532 prefs::kProfileAvatarTutorialShown, kProfileAvatarTutorialShowMax + 1);
533
534 ProfileMetrics::LogProfileMirrorEnrollment(
535 ProfileMetrics::PROFILE_ENROLLMENT_CLOSE_WELCOME_CARD);
532 ShowView(BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); 536 ShowView(BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get());
533 } else if (sender == tutorial_enable_new_profile_management_button_) { 537 } else if (sender == tutorial_enable_new_profile_management_button_) {
538 ProfileMetrics::LogProfileMirrorEnrollment(
539 ProfileMetrics::PROFILE_ENROLLMENT_ACCEPT_MIRROR);
534 profiles::EnableNewProfileManagementPreview(); 540 profiles::EnableNewProfileManagementPreview();
535 } else if (sender == remove_account_and_relaunch_button_) { 541 } else if (sender == remove_account_and_relaunch_button_) {
536 RemoveAccount(); 542 RemoveAccount();
537 } else if (sender == account_removal_cancel_button_) { 543 } else if (sender == account_removal_cancel_button_) {
538 account_id_to_remove_.clear(); 544 account_id_to_remove_.clear();
539 ShowView(BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get()); 545 ShowView(BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, avatar_menu_.get());
540 } else if (sender == gaia_signin_cancel_button_) { 546 } else if (sender == gaia_signin_cancel_button_) {
541 std::string primary_account = 547 std::string primary_account =
542 SigninManagerFactory::GetForProfile(browser_->profile())-> 548 SigninManagerFactory::GetForProfile(browser_->profile())->
543 GetAuthenticatedUsername(); 549 GetAuthenticatedUsername();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 // the account management view is displayed for non signed-in users. 595 // the account management view is displayed for non signed-in users.
590 ShowView( 596 ShowView(
591 view_mode_ == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT ? 597 view_mode_ == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT ?
592 BUBBLE_VIEW_MODE_PROFILE_CHOOSER : 598 BUBBLE_VIEW_MODE_PROFILE_CHOOSER :
593 BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, 599 BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT,
594 avatar_menu_.get()); 600 avatar_menu_.get());
595 } else if (sender == add_account_link_) { 601 } else if (sender == add_account_link_) {
596 ShowView(BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT, avatar_menu_.get()); 602 ShowView(BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT, avatar_menu_.get());
597 } else { 603 } else {
598 DCHECK(sender == tutorial_learn_more_link_); 604 DCHECK(sender == tutorial_learn_more_link_);
605 ProfileMetrics::LogProfileMirrorEnrollment(
606 ProfileMetrics::PROFILE_ENROLLMENT_LAUNCH_LEARN_MORE);
599 // TODO(guohui): update |learn_more_url| once it is decided. 607 // TODO(guohui): update |learn_more_url| once it is decided.
600 const GURL lear_more_url("https://support.google.com/chrome/?hl=en#to"); 608 const GURL lear_more_url("https://support.google.com/chrome/?hl=en#to");
601 chrome::NavigateParams params( 609 chrome::NavigateParams params(
602 browser_->profile(), 610 browser_->profile(),
603 lear_more_url, 611 lear_more_url,
604 content::PAGE_TRANSITION_LINK); 612 content::PAGE_TRANSITION_LINK);
605 params.disposition = NEW_FOREGROUND_TAB; 613 params.disposition = NEW_FOREGROUND_TAB;
606 chrome::Navigate(&params); 614 chrome::Navigate(&params);
607 } 615 }
608 } 616 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 CreateNewProfileManagementPreviewView(); 673 CreateNewProfileManagementPreviewView();
666 } else { 674 } else {
667 current_profile_accounts = CreateCurrentProfileAccountsView(item); 675 current_profile_accounts = CreateCurrentProfileAccountsView(item);
668 } 676 }
669 } else { 677 } else {
670 other_profiles.push_back(i); 678 other_profiles.push_back(i);
671 } 679 }
672 } 680 }
673 681
674 if (tutorial_view) { 682 if (tutorial_view) {
683 // Be sure not to track the tutorial display on View refresh, and only count
684 // the preview-promo view, not the welcome-enabled view.
685 if (tutorial_shown == false && !switches::IsNewProfileManagement()) {
686 ProfileMetrics::
687 LogProfileMirrorEnrollment(
688 ProfileMetrics::PROFILE_ENROLLMENT_SHOW_PREVIEW_PROMO);
689 }
675 layout->StartRow(1, 0); 690 layout->StartRow(1, 0);
676 layout->AddView(tutorial_view); 691 layout->AddView(tutorial_view);
677 } 692 }
678 693
679 if (!current_profile_view) { 694 if (!current_profile_view) {
680 // Guest windows don't have an active profile. 695 // Guest windows don't have an active profile.
681 current_profile_view = CreateGuestProfileView(); 696 current_profile_view = CreateGuestProfileView();
682 option_buttons_view = CreateOptionsView(false); 697 option_buttons_view = CreateOptionsView(false);
683 } 698 }
684 699
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 // Do not show the tutorial if user has dismissed it. 736 // Do not show the tutorial if user has dismissed it.
722 if (show_count > kProfileAvatarTutorialShowMax) 737 if (show_count > kProfileAvatarTutorialShowMax)
723 return NULL; 738 return NULL;
724 739
725 if (!tutorial_shown) { 740 if (!tutorial_shown) {
726 if (show_count == kProfileAvatarTutorialShowMax) 741 if (show_count == kProfileAvatarTutorialShowMax)
727 return NULL; 742 return NULL;
728 profile->GetPrefs()->SetInteger( 743 profile->GetPrefs()->SetInteger(
729 prefs::kProfileAvatarTutorialShown, show_count + 1); 744 prefs::kProfileAvatarTutorialShown, show_count + 1);
730 } 745 }
731 tutorial_showing_ = true;
732 746
733 return CreateTutorialView( 747 return CreateTutorialView(
734 l10n_util::GetStringUTF16(IDS_PROFILES_PREVIEW_ENABLED_TUTORIAL_TITLE), 748 l10n_util::GetStringUTF16(IDS_PROFILES_PREVIEW_ENABLED_TUTORIAL_TITLE),
735 l10n_util::GetStringUTF16( 749 l10n_util::GetStringUTF16(
736 IDS_PROFILES_PREVIEW_ENABLED_TUTORIAL_CONTENT_TEXT), 750 IDS_PROFILES_PREVIEW_ENABLED_TUTORIAL_CONTENT_TEXT),
737 l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_TUTORIAL_LEARN_MORE), 751 l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_TUTORIAL_LEARN_MORE),
738 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_OK_BUTTON), 752 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_OK_BUTTON),
739 &tutorial_learn_more_link_, 753 &tutorial_learn_more_link_,
740 &tutorial_ok_button_); 754 &tutorial_ok_button_);
741 } 755 }
742 756
743 views::View* ProfileChooserView::CreateTutorialView( 757 views::View* ProfileChooserView::CreateTutorialView(
744 const base::string16& title_text, 758 const base::string16& title_text,
745 const base::string16& content_text, 759 const base::string16& content_text,
746 const base::string16& link_text, 760 const base::string16& link_text,
747 const base::string16& button_text, 761 const base::string16& button_text,
748 views::Link** link, 762 views::Link** link,
749 views::LabelButton** button) { 763 views::LabelButton** button) {
764 tutorial_showing_ = true;
765
750 views::View* view = new views::View(); 766 views::View* view = new views::View();
751 view->set_background(views::Background::CreateSolidBackground( 767 view->set_background(views::Background::CreateSolidBackground(
752 profiles::kAvatarTutorialBackgroundColor)); 768 profiles::kAvatarTutorialBackgroundColor));
753 views::GridLayout* layout = CreateSingleColumnLayout(view, 769 views::GridLayout* layout = CreateSingleColumnLayout(view,
754 kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew); 770 kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew);
755 layout->SetInsets(views::kButtonVEdgeMarginNew, 771 layout->SetInsets(views::kButtonVEdgeMarginNew,
756 views::kButtonHEdgeMarginNew, 772 views::kButtonHEdgeMarginNew,
757 views::kButtonVEdgeMarginNew, 773 views::kButtonVEdgeMarginNew,
758 views::kButtonHEdgeMarginNew); 774 views::kButtonHEdgeMarginNew);
759 775
760 // Adds title. 776 // Adds title.
761 views::Label* title_label = new views::Label(title_text); 777 views::Label* title_label = new views::Label(title_text);
762 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 778 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
763 title_label->SetAutoColorReadabilityEnabled(false); 779 title_label->SetAutoColorReadabilityEnabled(false);
764 title_label->SetEnabledColor(SK_ColorWHITE); 780 title_label->SetEnabledColor(SK_ColorWHITE);
765 title_label ->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( 781 title_label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList(
766 ui::ResourceBundle::MediumFont)); 782 ui::ResourceBundle::MediumFont));
767 layout->StartRow(1, 0); 783 layout->StartRow(1, 0);
768 layout->AddView(title_label); 784 layout->AddView(title_label);
769 785
770 // Adds body content. 786 // Adds body content.
771 views::Label* content_label = new views::Label(content_text); 787 views::Label* content_label = new views::Label(content_text);
772 content_label->SetMultiLine(true); 788 content_label->SetMultiLine(true);
773 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 789 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
774 content_label->SetAutoColorReadabilityEnabled(false); 790 content_label->SetAutoColorReadabilityEnabled(false);
775 content_label->SetEnabledColor(profiles::kAvatarTutorialContentTextColor); 791 content_label->SetEnabledColor(profiles::kAvatarTutorialContentTextColor);
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 1164
1149 views::View* ProfileChooserView::CreateNewProfileManagementPreviewView() { 1165 views::View* ProfileChooserView::CreateNewProfileManagementPreviewView() {
1150 return CreateTutorialView( 1166 return CreateTutorialView(
1151 l10n_util::GetStringUTF16(IDS_PROFILES_PREVIEW_TUTORIAL_TITLE), 1167 l10n_util::GetStringUTF16(IDS_PROFILES_PREVIEW_TUTORIAL_TITLE),
1152 l10n_util::GetStringUTF16(IDS_PROFILES_PREVIEW_TUTORIAL_CONTENT_TEXT), 1168 l10n_util::GetStringUTF16(IDS_PROFILES_PREVIEW_TUTORIAL_CONTENT_TEXT),
1153 l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_TUTORIAL_LEARN_MORE), 1169 l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_TUTORIAL_LEARN_MORE),
1154 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_TRY_BUTTON), 1170 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_TRY_BUTTON),
1155 &tutorial_learn_more_link_, 1171 &tutorial_learn_more_link_,
1156 &tutorial_enable_new_profile_management_button_); 1172 &tutorial_enable_new_profile_management_button_);
1157 } 1173 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698