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

Unified Diff: chrome/browser/profiles/profile_window.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, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/browser_list.h » ('j') | chrome/browser/ui/browser_list.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_window.cc
diff --git a/chrome/browser/profiles/profile_window.cc b/chrome/browser/profiles/profile_window.cc
index 10b48e19cd03d7fa56cab89d3d442126198abc31..36986301a70aa83c01f6edd6ae593044375f48d6 100644
--- a/chrome/browser/profiles/profile_window.cc
+++ b/chrome/browser/profiles/profile_window.cc
@@ -259,25 +259,36 @@ void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type,
ProfileMetrics::LogProfileAddNewUser(metric);
}
+void GuestBrowserCloseSuccess(const size_t profile_index) {
+ chrome::ShowUserManager(base::FilePath());
+}
+
void CloseGuestProfileWindows() {
ProfileManager* profile_manager = g_browser_process->profile_manager();
Profile* profile = profile_manager->GetProfileByPath(
ProfileManager::GetGuestProfilePath());
if (profile) {
- BrowserList::CloseAllBrowsersWithProfile(profile);
+ BrowserList::CloseAllBrowsersWithProfile(profile,
+ base::Bind(&GuestBrowserCloseSuccess));
Peter Kasting 2014/08/28 18:46:12 Nit: All lines of args should be aligned (multiple
Mike Lerman 2014/08/29 18:02:20 Done.
}
}
-void LockProfile(Profile* profile) {
- DCHECK(profile);
+void LockBrowserCloseSuccess(const size_t profile_index) {
noms (inactive) 2014/08/28 19:22:29 I think it would be better if this took the profil
Mike Lerman 2014/08/29 18:02:21 Done.
ProfileInfoCache& cache =
Peter Kasting 2014/08/28 18:46:12 Nit: Use pointers or const refs rather than non-co
Mike Lerman 2014/08/29 18:02:20 Done.
g_browser_process->profile_manager()->GetProfileInfoCache();
+ DCHECK_LT(profile_index, cache.GetNumberOfProfiles());
+
+ cache.SetProfileSigninRequiredAtIndex(profile_index, true);
+ chrome::ShowUserManager(cache.GetPathOfProfileAtIndex(profile_index));
+}
- size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath());
- cache.SetProfileSigninRequiredAtIndex(index, true);
- chrome::ShowUserManager(profile->GetPath());
- BrowserList::CloseAllBrowsersWithProfile(profile);
+void LockProfile(Profile* profile) {
+ DCHECK(profile);
+ if (profile) {
+ BrowserList::CloseAllBrowsersWithProfile(profile,
+ base::Bind(&LockBrowserCloseSuccess));
+ }
}
void CreateGuestProfileForUserManager(
« no previous file with comments | « no previous file | chrome/browser/ui/browser_list.h » ('j') | chrome/browser/ui/browser_list.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698