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]; |
} |