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

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: working browser closing and lock included 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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, also close all the guest browser windows.
709 if (browser_->profile()->IsGuestSession()) { 709 if (browser_->profile()->IsGuestSession()) {
Peter Kasting 2014/08/26 20:26:15 Nit: {} no longer necessary here
Mike Lerman 2014/08/27 14:11:39 Bye bye braces! Thanks!
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 } 713 }
715 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_OPEN_USER_MANAGER); 714 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_OPEN_USER_MANAGER);
716 } else if (sender == go_incognito_button_) { 715 } else if (sender == go_incognito_button_) {
717 DCHECK(ShouldShowGoIncognito()); 716 DCHECK(ShouldShowGoIncognito());
718 chrome::NewIncognitoWindow(browser_); 717 chrome::NewIncognitoWindow(browser_);
719 } else if (sender == lock_button_) { 718 } else if (sender == lock_button_) {
720 profiles::LockProfile(browser_->profile()); 719 profiles::LockProfile(browser_->profile());
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 1634 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1636 IncognitoModePrefs::DISABLED; 1635 IncognitoModePrefs::DISABLED;
1637 return incognito_available && !browser_->profile()->IsGuestSession(); 1636 return incognito_available && !browser_->profile()->IsGuestSession();
1638 } 1637 }
1639 1638
1640 void ProfileChooserView::PostActionPerformed( 1639 void ProfileChooserView::PostActionPerformed(
1641 ProfileMetrics::ProfileDesktopMenu action_performed) { 1640 ProfileMetrics::ProfileDesktopMenu action_performed) {
1642 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 1641 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
1643 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 1642 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
1644 } 1643 }
OLDNEW
« chrome/browser/ui/browser_list.cc ('K') | « chrome/browser/ui/browser_list.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698