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

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

Issue 288493008: UMA Metrics for the user menu, including vasquette-detection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Track user-source in the histogram suffix 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"
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 profile_bubble_->GetWidget()->Close(); 414 profile_bubble_->GetWidget()->Close();
415 } 415 }
416 416
417 ProfileChooserView::ProfileChooserView(views::View* anchor_view, 417 ProfileChooserView::ProfileChooserView(views::View* anchor_view,
418 views::BubbleBorder::Arrow arrow, 418 views::BubbleBorder::Arrow arrow,
419 const gfx::Rect& anchor_rect, 419 const gfx::Rect& anchor_rect,
420 Browser* browser, 420 Browser* browser,
421 BubbleViewMode view_mode) 421 BubbleViewMode view_mode)
422 : BubbleDelegateView(anchor_view, arrow), 422 : BubbleDelegateView(anchor_view, arrow),
423 browser_(browser), 423 browser_(browser),
424 view_mode_(view_mode), 424 tutorial_mode_(TUTORIAL_MODE_NONE),
425 tutorial_mode_(TUTORIAL_MODE_NONE) { 425 view_mode_(view_mode == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT_FROM_GAIA ?
426 BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT : view_mode),
427 opened_from_gaia_(
428 view_mode == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT_FROM_GAIA) {
426 // Reset the default margins inherited from the BubbleDelegateView. 429 // Reset the default margins inherited from the BubbleDelegateView.
427 set_margins(gfx::Insets()); 430 set_margins(gfx::Insets());
428 431
429 ResetView(); 432 ResetView();
430 433
431 avatar_menu_.reset(new AvatarMenu( 434 avatar_menu_.reset(new AvatarMenu(
432 &g_browser_process->profile_manager()->GetProfileInfoCache(), 435 &g_browser_process->profile_manager()->GetProfileInfoCache(),
433 this, 436 this,
434 browser_)); 437 browser_));
435 avatar_menu_->RebuildMenu(); 438 avatar_menu_->RebuildMenu();
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 // has no parent (like in tests) because that will also crash. 564 // has no parent (like in tests) because that will also crash.
562 if (sender->parent()) 565 if (sender->parent())
563 sender->SetEnabled(false); 566 sender->SetEnabled(false);
564 567
565 if (sender == users_button_) { 568 if (sender == users_button_) {
566 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile()); 569 profiles::ShowUserManagerMaybeWithTutorial(browser_->profile());
567 // If this is a guest session, also close all the guest browser windows. 570 // If this is a guest session, also close all the guest browser windows.
568 if (browser_->profile()->IsGuestSession()) 571 if (browser_->profile()->IsGuestSession())
569 profiles::CloseGuestProfileWindows(); 572 profiles::CloseGuestProfileWindows();
570 } else if (sender == lock_button_) { 573 } else if (sender == lock_button_) {
574 ProfileMetrics::LogProfileDesktopSignout(
575 ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK, opened_from_gaia_);
571 profiles::LockProfile(browser_->profile()); 576 profiles::LockProfile(browser_->profile());
572 } else if (sender == tutorial_ok_button_) { 577 } else if (sender == tutorial_ok_button_) {
573 // If the user manually dismissed the tutorial, never show it again by 578 // If the user manually dismissed the tutorial, never show it again by
574 // setting the number of times shown to the maximum plus 1, so that later we 579 // setting the number of times shown to the maximum plus 1, so that later we
575 // could distinguish between the dismiss case and the case when the tutorial 580 // could distinguish between the dismiss case and the case when the tutorial
576 // is indeed shown for the maximum number of times. 581 // is indeed shown for the maximum number of times.
577 browser_->profile()->GetPrefs()->SetInteger( 582 browser_->profile()->GetPrefs()->SetInteger(
578 prefs::kProfileAvatarTutorialShown, kProfileAvatarTutorialShowMax + 1); 583 prefs::kProfileAvatarTutorialShown, kProfileAvatarTutorialShowMax + 1);
579 584
580 ProfileMetrics::LogProfileUpgradeEnrollment( 585 ProfileMetrics::LogProfileUpgradeEnrollment(
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 // buttons was pressed. 628 // buttons was pressed.
624 ButtonIndexes::const_iterator profile_match = 629 ButtonIndexes::const_iterator profile_match =
625 open_other_profile_indexes_map_.find(sender); 630 open_other_profile_indexes_map_.find(sender);
626 if (profile_match != open_other_profile_indexes_map_.end()) { 631 if (profile_match != open_other_profile_indexes_map_.end()) {
627 avatar_menu_->SwitchToProfile( 632 avatar_menu_->SwitchToProfile(
628 profile_match->second, 633 profile_match->second,
629 ui::DispositionFromEventFlags(event.flags()) == NEW_WINDOW, 634 ui::DispositionFromEventFlags(event.flags()) == NEW_WINDOW,
630 ProfileMetrics::SWITCH_PROFILE_ICON); 635 ProfileMetrics::SWITCH_PROFILE_ICON);
631 } else { 636 } else {
632 // This was a profile accounts button. 637 // This was a profile accounts button.
638 ProfileMetrics::LogProfileDesktopSignout(
639 ProfileMetrics::PROFILE_DESKTOP_MENU_REMOVE_ACCT,
640 opened_from_gaia_);
633 AccountButtonIndexes::const_iterator account_match = 641 AccountButtonIndexes::const_iterator account_match =
634 current_profile_accounts_map_.find(sender); 642 current_profile_accounts_map_.find(sender);
635 DCHECK(account_match != current_profile_accounts_map_.end()); 643 DCHECK(account_match != current_profile_accounts_map_.end());
636 account_id_to_remove_ = account_match->second; 644 account_id_to_remove_ = account_match->second;
637 ShowView(BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL, avatar_menu_.get()); 645 ShowView(BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL, avatar_menu_.get());
638 } 646 }
639 } 647 }
640 } 648 }
641 649
642 void ProfileChooserView::RemoveAccount() { 650 void ProfileChooserView::RemoveAccount() {
(...skipping 12 matching lines...) Expand all
655 if (sender == manage_accounts_link_) { 663 if (sender == manage_accounts_link_) {
656 // This link can either mean show/hide the account management view, 664 // This link can either mean show/hide the account management view,
657 // depending on which view it is displayed. ShowView() will DCHECK if 665 // depending on which view it is displayed. ShowView() will DCHECK if
658 // the account management view is displayed for non signed-in users. 666 // the account management view is displayed for non signed-in users.
659 ShowView( 667 ShowView(
660 view_mode_ == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT ? 668 view_mode_ == BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT ?
661 BUBBLE_VIEW_MODE_PROFILE_CHOOSER : 669 BUBBLE_VIEW_MODE_PROFILE_CHOOSER :
662 BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT, 670 BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT,
663 avatar_menu_.get()); 671 avatar_menu_.get());
664 } else if (sender == add_account_link_) { 672 } else if (sender == add_account_link_) {
673 ProfileMetrics::LogProfileDesktopSignout(
674 ProfileMetrics::PROFILE_DESKTOP_MENU_ADD_ACCT, opened_from_gaia_);
665 ShowView(BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT, avatar_menu_.get()); 675 ShowView(BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT, avatar_menu_.get());
666 } else if (sender == tutorial_learn_more_link_) { 676 } else if (sender == tutorial_learn_more_link_) {
667 ProfileMetrics::LogProfileUpgradeEnrollment( 677 ProfileMetrics::LogProfileUpgradeEnrollment(
668 ProfileMetrics::PROFILE_ENROLLMENT_LAUNCH_LEARN_MORE); 678 ProfileMetrics::PROFILE_ENROLLMENT_LAUNCH_LEARN_MORE);
669 // TODO(guohui): update |learn_more_url| once it is decided. 679 // TODO(guohui): update |learn_more_url| once it is decided.
670 const GURL lear_more_url("https://support.google.com/chrome/?hl=en#to"); 680 const GURL lear_more_url("https://support.google.com/chrome/?hl=en#to");
671 chrome::NavigateParams params( 681 chrome::NavigateParams params(
672 browser_->profile(), 682 browser_->profile(),
673 lear_more_url, 683 lear_more_url,
674 content::PAGE_TRANSITION_LINK); 684 content::PAGE_TRANSITION_LINK);
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 layout->StartRowWithPadding( 1312 layout->StartRowWithPadding(
1303 1, 0, 0, views::kUnrelatedControlVerticalSpacing); 1313 1, 0, 0, views::kUnrelatedControlVerticalSpacing);
1304 layout->AddView(end_preview_and_relaunch_button_); 1314 layout->AddView(end_preview_and_relaunch_button_);
1305 1315
1306 TitleCard* title_card = new TitleCard( 1316 TitleCard* title_card = new TitleCard(
1307 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_); 1317 IDS_PROFILES_END_PREVIEW, this, &end_preview_cancel_button_);
1308 return TitleCard::AddPaddedTitleCard( 1318 return TitleCard::AddPaddedTitleCard(
1309 view, title_card, kFixedAccountRemovalViewWidth); 1319 view, title_card, kFixedAccountRemovalViewWidth);
1310 } 1320 }
1311 1321
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698