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

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

Powered by Google App Engine
This is Rietveld 408576698