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

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: Rebase 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::
535 LogProfileMirrorEnrollment(ProfileMetrics::ENROLL_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_) {
534 profiles::EnableNewProfileManagementPreview(); 538 profiles::EnableNewProfileManagementPreview();
539 ProfileMetrics::
540 LogProfileMirrorEnrollment(ProfileMetrics::ENROLL_ACCEPT_MIRROR);
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();
544 ShowView(primary_account.empty() ? BUBBLE_VIEW_MODE_PROFILE_CHOOSER : 550 ShowView(primary_account.empty() ? BUBBLE_VIEW_MODE_PROFILE_CHOOSER :
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_);
599 // TODO(guohui): update |learn_more_url| once it is decided. 605 // TODO(guohui): update |learn_more_url| once it is decided.
606 ProfileMetrics::
607 LogProfileMirrorEnrollment(ProfileMetrics::ENROLL_LAUNCH_LEARN_MORE);
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 }
609 617
(...skipping 55 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 (!switches::IsNewProfileManagement()) {
686 ProfileMetrics::
687 LogProfileMirrorEnrollment(ProfileMetrics::ENROLL_SHOW_PREVIEW_PROMO);
688 }
guohui 2014/04/28 19:26:18 hmm, but you do track the tutorial display on view
Mike Lerman 2014/04/28 20:43:27 Done.
675 layout->StartRow(1, 0); 689 layout->StartRow(1, 0);
676 layout->AddView(tutorial_view); 690 layout->AddView(tutorial_view);
677 } 691 }
678 692
679 if (!current_profile_view) { 693 if (!current_profile_view) {
680 // Guest windows don't have an active profile. 694 // Guest windows don't have an active profile.
681 current_profile_view = CreateGuestProfileView(); 695 current_profile_view = CreateGuestProfileView();
682 option_buttons_view = CreateOptionsView(false); 696 option_buttons_view = CreateOptionsView(false);
683 } 697 }
684 698
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 layout->SetInsets(views::kButtonVEdgeMarginNew, 769 layout->SetInsets(views::kButtonVEdgeMarginNew,
756 views::kButtonHEdgeMarginNew, 770 views::kButtonHEdgeMarginNew,
757 views::kButtonVEdgeMarginNew, 771 views::kButtonVEdgeMarginNew,
758 views::kButtonHEdgeMarginNew); 772 views::kButtonHEdgeMarginNew);
759 773
760 // Adds title. 774 // Adds title.
761 views::Label* title_label = new views::Label(title_text); 775 views::Label* title_label = new views::Label(title_text);
762 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 776 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
763 title_label->SetAutoColorReadabilityEnabled(false); 777 title_label->SetAutoColorReadabilityEnabled(false);
764 title_label->SetEnabledColor(SK_ColorWHITE); 778 title_label->SetEnabledColor(SK_ColorWHITE);
765 title_label ->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( 779 title_label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList(
766 ui::ResourceBundle::MediumFont)); 780 ui::ResourceBundle::MediumFont));
767 layout->StartRow(1, 0); 781 layout->StartRow(1, 0);
768 layout->AddView(title_label); 782 layout->AddView(title_label);
769 783
770 // Adds body content. 784 // Adds body content.
771 views::Label* content_label = new views::Label(content_text); 785 views::Label* content_label = new views::Label(content_text);
772 content_label->SetMultiLine(true); 786 content_label->SetMultiLine(true);
773 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 787 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
774 content_label->SetAutoColorReadabilityEnabled(false); 788 content_label->SetAutoColorReadabilityEnabled(false);
775 content_label->SetEnabledColor(profiles::kAvatarTutorialContentTextColor); 789 content_label->SetEnabledColor(profiles::kAvatarTutorialContentTextColor);
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 1162
1149 views::View* ProfileChooserView::CreateNewProfileManagementPreviewView() { 1163 views::View* ProfileChooserView::CreateNewProfileManagementPreviewView() {
1150 return CreateTutorialView( 1164 return CreateTutorialView(
1151 l10n_util::GetStringUTF16(IDS_PROFILES_PREVIEW_TUTORIAL_TITLE), 1165 l10n_util::GetStringUTF16(IDS_PROFILES_PREVIEW_TUTORIAL_TITLE),
1152 l10n_util::GetStringUTF16(IDS_PROFILES_PREVIEW_TUTORIAL_CONTENT_TEXT), 1166 l10n_util::GetStringUTF16(IDS_PROFILES_PREVIEW_TUTORIAL_CONTENT_TEXT),
1153 l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_TUTORIAL_LEARN_MORE), 1167 l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_TUTORIAL_LEARN_MORE),
1154 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_TRY_BUTTON), 1168 l10n_util::GetStringUTF16(IDS_PROFILES_TUTORIAL_TRY_BUTTON),
1155 &tutorial_learn_more_link_, 1169 &tutorial_learn_more_link_,
1156 &tutorial_enable_new_profile_management_button_); 1170 &tutorial_enable_new_profile_management_button_);
1157 } 1171 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698