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

Unified Diff: chrome/browser/ui/cocoa/profiles/user_manager_mac.mm

Issue 885493005: Setting Guest last-active for the User Manager doesn't create the Guest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Oh noes, the braces Created 5 years, 11 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
Index: chrome/browser/ui/cocoa/profiles/user_manager_mac.mm
diff --git a/chrome/browser/ui/cocoa/profiles/user_manager_mac.mm b/chrome/browser/ui/cocoa/profiles/user_manager_mac.mm
index 89fd112b6e3f02c0fede01052ce0d13e800c1569..9452eaef915f75c6352bf33f8912ab4e7c44cc38 100644
--- a/chrome/browser/ui/cocoa/profiles/user_manager_mac.mm
+++ b/chrome/browser/ui/cocoa/profiles/user_manager_mac.mm
@@ -23,6 +23,21 @@
#include "ui/base/l10n/l10n_util_mac.h"
#include "ui/events/keycodes/keyboard_codes.h"
+namespace {
+
+// Update the App Controller with a new Profile. Used when a Profile is locked
+// to set the Controller to the Guest Profile so the old Profile's bookmarks,
+// etc... cannot be accessed.
+void ChangeAppControllerForProfile(Profile* profile,
+ Profile::CreateStatus status) {
+ if (status == Profile::CREATE_STATUS_INITIALIZED) {
+ AppController* controller =
+ base::mac::ObjCCast<AppController>([NSApp delegate]);
+ [controller windowChangedToProfile:profile];
+ }
+}
+
+} // namespace
// An open User Manager window. There can only be one open at a time. This
// is reset to NULL when the window is closed.
@@ -141,11 +156,13 @@ class UserManagerWebContentsDelegate : public content::WebContentsDelegate {
// will not trigger a -windowChangedToProfile and update the menu bar.
// This is only important if the active profile is Guest, which may have
// happened after locking a profile.
- Profile* guestProfile = profiles::SetActiveProfileToGuestIfLocked();
- if (guestProfile && guestProfile->IsGuestSession()) {
- AppController* controller =
- base::mac::ObjCCast<AppController>([NSApp delegate]);
- [controller windowChangedToProfile:guestProfile];
+ if (profiles::SetActiveProfileToGuestIfLocked()) {
+ g_browser_process->profile_manager()->CreateProfileAsync(
+ ProfileManager::GetGuestProfilePath(),
+ base::Bind(&ChangeAppControllerForProfile),
+ base::string16(),
+ base::string16(),
+ std::string());
}
[[self window] makeKeyAndOrderFront:self];
}
« no previous file with comments | « chrome/browser/profiles/profiles_state.cc ('k') | chrome/browser/ui/cocoa/profiles/user_manager_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698