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

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: Change to local static bool with AutoReset 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 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..811b2ef19840fd43906b382e70578fef89326f93 100644
--- a/chrome/browser/profiles/profile_window.cc
+++ b/chrome/browser/profiles/profile_window.cc
@@ -259,25 +259,38 @@ void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type,
ProfileMetrics::LogProfileAddNewUser(metric);
}
+void GuestBrowserCloseSuccess(const base::FilePath& profile_path) {
+ chrome::ShowUserManager(profile_path);
+}
+
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));
noms (inactive) 2014/09/03 14:25:08 nit: i think the base::Bind can go on the same lin
Mike Lerman 2014/09/03 15:28:34 Done.
}
}
+void LockBrowserCloseSuccess(const base::FilePath& profile_path) {
+ ProfileInfoCache* cache =
+ &g_browser_process->profile_manager()->GetProfileInfoCache();
+
+ cache->SetProfileSigninRequiredAtIndex(
+ cache->GetIndexOfProfileWithPath(profile_path),
+ true);
Peter Kasting 2014/09/02 19:40:34 Nit: Can place on end of previous line if you want
Mike Lerman 2014/09/03 15:28:34 Done.
+ chrome::ShowUserManager(profile_path);
+}
+
void LockProfile(Profile* profile) {
DCHECK(profile);
- ProfileInfoCache& cache =
- g_browser_process->profile_manager()->GetProfileInfoCache();
-
- size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath());
- cache.SetProfileSigninRequiredAtIndex(index, true);
- chrome::ShowUserManager(profile->GetPath());
- BrowserList::CloseAllBrowsersWithProfile(profile);
+ if (profile) {
+ BrowserList::CloseAllBrowsersWithProfile(profile,
Peter Kasting 2014/09/02 19:40:34 Nit: Place |profile| on next line; you may leave t
Mike Lerman 2014/09/03 15:28:34 Done.
+ 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