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