Chromium Code Reviews| 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..24413edeb490c6fb83ee1d7ac09e8a4325f9c6ed 100644 |
| --- a/chrome/browser/ui/cocoa/profiles/user_manager_mac.mm |
| +++ b/chrome/browser/ui/cocoa/profiles/user_manager_mac.mm |
| @@ -23,6 +23,18 @@ |
| #include "ui/base/l10n/l10n_util_mac.h" |
| #include "ui/events/keycodes/keyboard_codes.h" |
| +namespace { |
| + |
| +void ChangeAppControllerForProfile(Profile* profile, |
|
Alexei Svitkine (slow)
2015/01/28 21:12:32
Add a comment.
Mike Lerman
2015/01/29 14:01:58
Done.
|
| + Profile::CreateStatus status) { |
| + if (status == Profile::CREATE_STATUS_INITIALIZED) { |
| + AppController* controller = |
| + base::mac::ObjCCast<AppController>([NSApp delegate]); |
| + [controller windowChangedToProfile:profile]; |
| + } |
| +} |
| + |
| +} |
|
Alexei Svitkine (slow)
2015/01/28 21:12:32
Add " // namespace" comment.
Mike Lerman
2015/01/29 14:01:58
Done.
|
| // 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 +153,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]; |
| } |