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

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: review comments + rebase Created 6 years, 2 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 "base/mac/foundation_util.h"
7 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #import "chrome/browser/app_controller_mac.h"
8 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/profiles/profile_manager.h" 11 #include "chrome/browser/profiles/profile_manager.h"
12 #include "chrome/browser/profiles/profiles_state.h"
10 #include "chrome/browser/ui/browser_dialogs.h" 13 #include "chrome/browser/ui/browser_dialogs.h"
11 #import "chrome/browser/ui/cocoa/browser_window_utils.h" 14 #import "chrome/browser/ui/cocoa/browser_window_utils.h"
12 #include "chrome/browser/ui/cocoa/chrome_event_processing_window.h" 15 #include "chrome/browser/ui/cocoa/chrome_event_processing_window.h"
13 #include "chrome/grit/chromium_strings.h" 16 #include "chrome/grit/chromium_strings.h"
14 #include "content/public/browser/native_web_keyboard_event.h" 17 #include "content/public/browser/native_web_keyboard_event.h"
15 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
16 #include "content/public/browser/web_contents_delegate.h" 19 #include "content/public/browser/web_contents_delegate.h"
17 #include "ui/base/l10n/l10n_util_mac.h" 20 #include "ui/base/l10n/l10n_util_mac.h"
18 #include "ui/events/keycodes/keyboard_codes.h" 21 #include "ui/events/keycodes/keyboard_codes.h"
19 22
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 142 }
140 143
141 - (void)showURL:(const GURL&)url { 144 - (void)showURL:(const GURL&)url {
142 webContents_->GetController().LoadURL(url, content::Referrer(), 145 webContents_->GetController().LoadURL(url, content::Referrer(),
143 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 146 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
144 std::string()); 147 std::string());
145 [self show]; 148 [self show];
146 } 149 }
147 150
148 - (void)show { 151 - (void)show {
152 // Because the User Manager isn't a BrowserWindowController, activating it
153 // will not trigger a -windowChangedToProfile and update the menu bar.
154 // This is only important if the active profile is Guest, which may have
155 // happened after locking a profile.
156 Profile* guestProfile = profiles::SetActiveProfileToGuestIfLocked();
157 if (guestProfile && guestProfile->IsGuestSession()) {
158 AppController* controller =
159 base::mac::ObjCCast<AppController>([NSApp delegate]);
160 [controller windowChangedToProfile:guestProfile];
161 }
149 [[self window] makeKeyAndOrderFront:self]; 162 [[self window] makeKeyAndOrderFront:self];
150 } 163 }
151 164
152 - (void)close { 165 - (void)close {
153 [[self window] close]; 166 [[self window] close];
154 } 167 }
155 168
156 -(BOOL)isVisible { 169 -(BOOL)isVisible {
157 return [[self window] isVisible]; 170 return [[self window] isVisible];
158 } 171 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 void UserManagerMac::OnGuestProfileCreated(Profile* guest_profile, 221 void UserManagerMac::OnGuestProfileCreated(Profile* guest_profile,
209 const std::string& url) { 222 const std::string& url) {
210 instance_ = new UserManagerMac(guest_profile); 223 instance_ = new UserManagerMac(guest_profile);
211 [instance_->window_controller_ showURL:GURL(url)]; 224 [instance_->window_controller_ showURL:GURL(url)];
212 } 225 }
213 226
214 void UserManagerMac::WindowWasClosed() { 227 void UserManagerMac::WindowWasClosed() {
215 instance_ = NULL; 228 instance_ = NULL;
216 delete this; 229 delete this;
217 } 230 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698