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

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

Issue 471763008: Nicely handle OnBeforeUnloads with guest and lock mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup browser close; callback reset Created 6 years, 3 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
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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 698
699 void ProfileChooserView::ButtonPressed(views::Button* sender, 699 void ProfileChooserView::ButtonPressed(views::Button* sender,
700 const ui::Event& event) { 700 const ui::Event& event) {
701 // Disable button after clicking so that it doesn't get clicked twice and 701 // Disable button after clicking so that it doesn't get clicked twice and
702 // start a second action... which can crash Chrome. But don't disable if it 702 // start a second action... which can crash Chrome. But don't disable if it
703 // has no parent (like in tests) because that will also crash. 703 // has no parent (like in tests) because that will also crash.
704 if (sender->parent()) 704 if (sender->parent())
705 sender->SetEnabled(false); 705 sender->SetEnabled(false);
706 706
707 if (sender == users_button_) { 707 if (sender == users_button_) {
708 // If this is a guest session, also close all the guest browser windows. 708 // If this is a guest session, close all the guest browser windows.
709 if (browser_->profile()->IsGuestSession()) { 709 if (browser_->profile()->IsGuestSession())
710 chrome::ShowUserManager(base::FilePath());
711 profiles::CloseGuestProfileWindows(); 710 profiles::CloseGuestProfileWindows();
712 } else { 711 else
713 chrome::ShowUserManager(browser_->profile()->GetPath()); 712 chrome::ShowUserManager(browser_->profile()->GetPath());
714 }
715 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_OPEN_USER_MANAGER); 713 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_OPEN_USER_MANAGER);
716 } else if (sender == go_incognito_button_) { 714 } else if (sender == go_incognito_button_) {
717 DCHECK(ShouldShowGoIncognito()); 715 DCHECK(ShouldShowGoIncognito());
718 chrome::NewIncognitoWindow(browser_); 716 chrome::NewIncognitoWindow(browser_);
719 } else if (sender == lock_button_) { 717 } else if (sender == lock_button_) {
720 profiles::LockProfile(browser_->profile()); 718 profiles::LockProfile(browser_->profile());
721 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK); 719 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_LOCK);
722 } else if (sender == auth_error_email_button_) { 720 } else if (sender == auth_error_email_button_) {
723 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH, avatar_menu_.get()); 721 ShowView(profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH, avatar_menu_.get());
724 } else if (sender == tutorial_sync_settings_ok_button_) { 722 } else if (sender == tutorial_sync_settings_ok_button_) {
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 1633 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1636 IncognitoModePrefs::DISABLED; 1634 IncognitoModePrefs::DISABLED;
1637 return incognito_available && !browser_->profile()->IsGuestSession(); 1635 return incognito_available && !browser_->profile()->IsGuestSession();
1638 } 1636 }
1639 1637
1640 void ProfileChooserView::PostActionPerformed( 1638 void ProfileChooserView::PostActionPerformed(
1641 ProfileMetrics::ProfileDesktopMenu action_performed) { 1639 ProfileMetrics::ProfileDesktopMenu action_performed) {
1642 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 1640 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
1643 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 1641 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
1644 } 1642 }
OLDNEW
« chrome/browser/ui/unload_controller.cc ('K') | « chrome/browser/ui/unload_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698