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/macros.h" | 7 #include "base/macros.h" |
8 #include "base/metrics/user_metrics.h" | 8 #include "base/metrics/user_metrics.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 bool ProfileChooserView::close_on_deactivate_for_testing_ = true; | 691 bool ProfileChooserView::close_on_deactivate_for_testing_ = true; |
692 | 692 |
693 // static | 693 // static |
694 void ProfileChooserView::ShowBubble( | 694 void ProfileChooserView::ShowBubble( |
695 profiles::BubbleViewMode view_mode, | 695 profiles::BubbleViewMode view_mode, |
696 profiles::TutorialMode tutorial_mode, | 696 profiles::TutorialMode tutorial_mode, |
697 const signin::ManageAccountsParams& manage_accounts_params, | 697 const signin::ManageAccountsParams& manage_accounts_params, |
698 signin_metrics::AccessPoint access_point, | 698 signin_metrics::AccessPoint access_point, |
699 views::View* anchor_view, | 699 views::View* anchor_view, |
700 Browser* browser) { | 700 Browser* browser) { |
| 701 if (switches::IsMaterialDesignUserMenu()) { |
| 702 // The Material Design User Menu doesn't have a fast user switcher on |
| 703 // right-click. To ease up the transition for users, show the regular user |
| 704 // menu when right-clicking instead of doing nothing. |
| 705 view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; |
| 706 } |
| 707 |
701 // Don't start creating the view if it would be an empty fast user switcher. | 708 // Don't start creating the view if it would be an empty fast user switcher. |
702 // It has to happen here to prevent the view system from creating an empty | 709 // It has to happen here to prevent the view system from creating an empty |
703 // container. | 710 // container. |
704 // Same for material design user menu since fast profile switcher will be | |
705 // migrated to the left-click menu. | |
706 if (view_mode == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER && | 711 if (view_mode == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER && |
707 (!profiles::HasProfileSwitchTargets(browser->profile()) || | 712 !profiles::HasProfileSwitchTargets(browser->profile())) { |
708 switches::IsMaterialDesignUserMenu())) { | |
709 return; | 713 return; |
710 } | 714 } |
711 | 715 |
712 if (IsShowing()) { | 716 if (IsShowing()) { |
713 if (tutorial_mode != profiles::TUTORIAL_MODE_NONE) { | 717 if (tutorial_mode != profiles::TUTORIAL_MODE_NONE) { |
714 profile_bubble_->tutorial_mode_ = tutorial_mode; | 718 profile_bubble_->tutorial_mode_ = tutorial_mode; |
715 profile_bubble_->ShowViewFromMode(view_mode); | 719 profile_bubble_->ShowViewFromMode(view_mode); |
716 } | 720 } |
717 return; | 721 return; |
718 } | 722 } |
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2305 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 2309 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
2306 IncognitoModePrefs::DISABLED; | 2310 IncognitoModePrefs::DISABLED; |
2307 return incognito_available && !browser_->profile()->IsGuestSession(); | 2311 return incognito_available && !browser_->profile()->IsGuestSession(); |
2308 } | 2312 } |
2309 | 2313 |
2310 void ProfileChooserView::PostActionPerformed( | 2314 void ProfileChooserView::PostActionPerformed( |
2311 ProfileMetrics::ProfileDesktopMenu action_performed) { | 2315 ProfileMetrics::ProfileDesktopMenu action_performed) { |
2312 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 2316 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
2313 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 2317 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
2314 } | 2318 } |
OLD | NEW |