| 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/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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 | 487 |
| 488 // static | 488 // static |
| 489 void ProfileChooserView::ShowBubble( | 489 void ProfileChooserView::ShowBubble( |
| 490 profiles::BubbleViewMode view_mode, | 490 profiles::BubbleViewMode view_mode, |
| 491 profiles::TutorialMode tutorial_mode, | 491 profiles::TutorialMode tutorial_mode, |
| 492 const signin::ManageAccountsParams& manage_accounts_params, | 492 const signin::ManageAccountsParams& manage_accounts_params, |
| 493 views::View* anchor_view, | 493 views::View* anchor_view, |
| 494 views::BubbleBorder::Arrow arrow, | 494 views::BubbleBorder::Arrow arrow, |
| 495 views::BubbleBorder::BubbleAlignment border_alignment, | 495 views::BubbleBorder::BubbleAlignment border_alignment, |
| 496 Browser* browser) { | 496 Browser* browser) { |
| 497 // Don't start creating the view if it would be an empty fast user switcher. |
| 498 // This is the case when there is 0 or 1 profiles (the current one). It has |
| 499 // to happen here to prevent the view system from creating an empty container. |
| 500 if (view_mode == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER && |
| 501 g_browser_process->profile_manager()->GetNumberOfProfiles() <= 1) { |
| 502 return; |
| 503 } |
| 504 |
| 497 if (IsShowing()) { | 505 if (IsShowing()) { |
| 498 if (tutorial_mode != profiles::TUTORIAL_MODE_NONE) { | 506 if (tutorial_mode != profiles::TUTORIAL_MODE_NONE) { |
| 499 profile_bubble_->tutorial_mode_ = tutorial_mode; | 507 profile_bubble_->tutorial_mode_ = tutorial_mode; |
| 500 profile_bubble_->ShowView(view_mode, profile_bubble_->avatar_menu_.get()); | 508 profile_bubble_->ShowView(view_mode, profile_bubble_->avatar_menu_.get()); |
| 501 } | 509 } |
| 502 return; | 510 return; |
| 503 } | 511 } |
| 504 | 512 |
| 505 profile_bubble_ = new ProfileChooserView(anchor_view, arrow, browser, | 513 profile_bubble_ = new ProfileChooserView(anchor_view, arrow, browser, |
| 506 view_mode, tutorial_mode, manage_accounts_params.service_type); | 514 view_mode, tutorial_mode, manage_accounts_params.service_type); |
| (...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1705 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1713 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 1706 IncognitoModePrefs::DISABLED; | 1714 IncognitoModePrefs::DISABLED; |
| 1707 return incognito_available && !browser_->profile()->IsGuestSession(); | 1715 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 1708 } | 1716 } |
| 1709 | 1717 |
| 1710 void ProfileChooserView::PostActionPerformed( | 1718 void ProfileChooserView::PostActionPerformed( |
| 1711 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1719 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 1712 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1720 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 1713 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1721 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 1714 } | 1722 } |
| OLD | NEW |