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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 | 700 |
701 void ProfileChooserView::ButtonPressed(views::Button* sender, | 701 void ProfileChooserView::ButtonPressed(views::Button* sender, |
702 const ui::Event& event) { | 702 const ui::Event& event) { |
703 // Disable button after clicking so that it doesn't get clicked twice and | 703 // Disable button after clicking so that it doesn't get clicked twice and |
704 // start a second action... which can crash Chrome. But don't disable if it | 704 // start a second action... which can crash Chrome. But don't disable if it |
705 // has no parent (like in tests) because that will also crash. | 705 // has no parent (like in tests) because that will also crash. |
706 if (sender->parent()) | 706 if (sender->parent()) |
707 sender->SetEnabled(false); | 707 sender->SetEnabled(false); |
708 | 708 |
709 if (sender == users_button_) { | 709 if (sender == users_button_) { |
710 // If this is a guest session, also close all the guest browser windows. | 710 // If this is a guest session, close all the guest browser windows. |
711 if (browser_->profile()->IsGuestSession()) { | 711 if (browser_->profile()->IsGuestSession()) |
712 chrome::ShowUserManager(base::FilePath()); | |
713 profiles::CloseGuestProfileWindows(); | 712 profiles::CloseGuestProfileWindows(); |
714 } else { | 713 else |
715 chrome::ShowUserManager(browser_->profile()->GetPath()); | 714 chrome::ShowUserManager(browser_->profile()->GetPath()); |
716 } | |
717 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_OPEN_USER_MANAGER); | 715 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_OPEN_USER_MANAGER); |
718 } else if (sender == go_incognito_button_) { | 716 } else if (sender == go_incognito_button_) { |
719 DCHECK(ShouldShowGoIncognito()); | 717 DCHECK(ShouldShowGoIncognito()); |
720 chrome::NewIncognitoWindow(browser_); | 718 chrome::NewIncognitoWindow(browser_); |
721 } else if (sender == lock_button_) { | 719 } else if (sender == lock_button_) { |
722 profiles::LockProfile(browser_->profile()); | 720 profiles::LockProfile(browser_->profile()); |
723 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK); | 721 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK); |
724 } else if (sender == auth_error_email_button_) { | 722 } else if (sender == auth_error_email_button_) { |
725 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH, avatar_menu_.get()); | 723 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH, avatar_menu_.get()); |
726 } else if (sender == tutorial_sync_settings_ok_button_) { | 724 } else if (sender == tutorial_sync_settings_ok_button_) { |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1641 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
1644 IncognitoModePrefs::DISABLED; | 1642 IncognitoModePrefs::DISABLED; |
1645 return incognito_available && !browser_->profile()->IsGuestSession(); | 1643 return incognito_available && !browser_->profile()->IsGuestSession(); |
1646 } | 1644 } |
1647 | 1645 |
1648 void ProfileChooserView::PostActionPerformed( | 1646 void ProfileChooserView::PostActionPerformed( |
1649 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1647 ProfileMetrics::ProfileDesktopMenu action_performed) { |
1650 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1648 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
1651 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1649 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
1652 } | 1650 } |
OLD | NEW |