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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/cocoa/profiles/user_manager_mac.h" 5 #include "chrome/browser/ui/cocoa/profiles/user_manager_mac.h"
6 6
7 #include "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #import "chrome/browser/app_controller_mac.h"
8 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/profiles/profile_manager.h" 10 #include "chrome/browser/profiles/profile_manager.h"
11 #include "chrome/browser/profiles/profiles_state.h"
10 #include "chrome/browser/ui/browser_dialogs.h" 12 #include "chrome/browser/ui/browser_dialogs.h"
11 #import "chrome/browser/ui/cocoa/browser_window_utils.h" 13 #import "chrome/browser/ui/cocoa/browser_window_utils.h"
12 #include "chrome/browser/ui/cocoa/chrome_event_processing_window.h" 14 #include "chrome/browser/ui/cocoa/chrome_event_processing_window.h"
13 #include "chrome/grit/chromium_strings.h" 15 #include "chrome/grit/chromium_strings.h"
14 #include "content/public/browser/native_web_keyboard_event.h" 16 #include "content/public/browser/native_web_keyboard_event.h"
15 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
16 #include "content/public/browser/web_contents_delegate.h" 18 #include "content/public/browser/web_contents_delegate.h"
17 #include "ui/base/l10n/l10n_util_mac.h" 19 #include "ui/base/l10n/l10n_util_mac.h"
18 20
19 // Default window size. Taken from the views implementation in 21 // Default window size. Taken from the views implementation in
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 139 }
138 140
139 - (void)showURL:(const GURL&)url { 141 - (void)showURL:(const GURL&)url {
140 webContents_->GetController().LoadURL(url, content::Referrer(), 142 webContents_->GetController().LoadURL(url, content::Referrer(),
141 content::PAGE_TRANSITION_AUTO_TOPLEVEL, 143 content::PAGE_TRANSITION_AUTO_TOPLEVEL,
142 std::string()); 144 std::string());
143 [self show]; 145 [self show];
144 } 146 }
145 147
146 - (void)show { 148 - (void)show {
149 // Because the User Manager isn't a BrowserWindowController, activating it
150 // will not trigger a -windowChangedToProfile and update the menu bar.
151 // This is only important if the active profile is Guest, which may have
152 // 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
153 profiles::SetActiveProfileToGuestIfLocked();
154 Profile* activeProfile = ProfileManager::GetLastUsedProfile();
155 if (activeProfile->IsGuestSession()) {
156 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.
157 [controller windowChangedToProfile:activeProfile];
158 }
147 [[self window] makeKeyAndOrderFront:self]; 159 [[self window] makeKeyAndOrderFront:self];
148 } 160 }
149 161
150 - (void)close { 162 - (void)close {
151 [[self window] close]; 163 [[self window] close];
152 } 164 }
153 165
154 -(BOOL)isVisible { 166 -(BOOL)isVisible {
155 return [[self window] isVisible]; 167 return [[self window] isVisible];
156 } 168 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 void UserManagerMac::OnGuestProfileCreated(Profile* guest_profile, 218 void UserManagerMac::OnGuestProfileCreated(Profile* guest_profile,
207 const std::string& url) { 219 const std::string& url) {
208 instance_ = new UserManagerMac(guest_profile); 220 instance_ = new UserManagerMac(guest_profile);
209 [instance_->window_controller_ showURL:GURL(url)]; 221 [instance_->window_controller_ showURL:GURL(url)];
210 } 222 }
211 223
212 void UserManagerMac::WindowWasClosed() { 224 void UserManagerMac::WindowWasClosed() {
213 instance_ = NULL; 225 instance_ = NULL;
214 delete this; 226 delete this;
215 } 227 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698