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

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

Issue 585653002: After locking a profile and showing the User Manager, make Guest the active profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
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 957d95ba57bb6b8b04cab3e077f8fa47836a668c..74be1f08427a321f2c1913c30c69783b9df36288 100644
--- a/chrome/browser/ui/cocoa/profiles/user_manager_mac.mm
+++ b/chrome/browser/ui/cocoa/profiles/user_manager_mac.mm
@@ -5,8 +5,10 @@
#include "chrome/browser/ui/cocoa/profiles/user_manager_mac.h"
#include "chrome/app/chrome_command_ids.h"
+#import "chrome/browser/app_controller_mac.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/ui/browser_dialogs.h"
#import "chrome/browser/ui/cocoa/browser_window_utils.h"
#include "chrome/browser/ui/cocoa/chrome_event_processing_window.h"
@@ -144,6 +146,16 @@ class UserManagerWebContentsDelegate : public content::WebContentsDelegate {
}
- (void)show {
+ // Because the User Manager isn't a BrowserWindowController, activating it
+ // 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.
Alexei Svitkine (slow) 2014/09/19 15:33:37 Is it possible to lock a profile after this window
noms (inactive) 2014/09/22 15:39:45 Yes. You could leave this window open (it's not mo
+ profiles::SetActiveProfileToGuestIfLocked();
+ Profile* activeProfile = ProfileManager::GetLastUsedProfile();
+ if (activeProfile->IsGuestSession()) {
+ AppController* controller = [NSApp delegate];
Alexei Svitkine (slow) 2014/09/19 15:33:36 Use base::mac::ObjCCast<AppController>() instead o
noms (inactive) 2014/09/22 15:39:45 Done.
+ [controller windowChangedToProfile:activeProfile];
+ }
[[self window] makeKeyAndOrderFront:self];
}

Powered by Google App Engine
This is Rietveld 408576698