| OLD | NEW |
| 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 "base/mac/foundation_util.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #import "chrome/browser/app_controller_mac.h" | 9 #import "chrome/browser/app_controller_mac.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::OPEN_USER_MANAGER); | 176 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::OPEN_USER_MANAGER); |
| 177 if (instance_) { | 177 if (instance_) { |
| 178 // If there's a user manager window open already, just activate it. | 178 // If there's a user manager window open already, just activate it. |
| 179 [instance_->window_controller() show]; | 179 [instance_->window_controller() show]; |
| 180 return; | 180 return; |
| 181 } | 181 } |
| 182 | 182 |
| 183 // Create the guest profile, if necessary, and open the User Manager | 183 // Create the guest profile, if necessary, and open the User Manager |
| 184 // from the guest profile. | 184 // from the guest profile. |
| 185 profiles::CreateGuestProfileForUserManager( | 185 profiles::CreateSystemProfileForUserManager( |
| 186 profile_path_to_focus, | 186 profile_path_to_focus, |
| 187 tutorial_mode, | 187 tutorial_mode, |
| 188 profile_open_action, | 188 profile_open_action, |
| 189 base::Bind(&UserManagerMac::OnGuestProfileCreated)); | 189 base::Bind(&UserManagerMac::OnSystemProfileCreated)); |
| 190 } | 190 } |
| 191 | 191 |
| 192 void UserManager::Hide() { | 192 void UserManager::Hide() { |
| 193 if (instance_) | 193 if (instance_) |
| 194 [instance_->window_controller() close]; | 194 [instance_->window_controller() close]; |
| 195 } | 195 } |
| 196 | 196 |
| 197 bool UserManager::IsShowing() { | 197 bool UserManager::IsShowing() { |
| 198 return instance_ ? [instance_->window_controller() isVisible]: false; | 198 return instance_ ? [instance_->window_controller() isVisible]: false; |
| 199 } | 199 } |
| 200 | 200 |
| 201 UserManagerMac::UserManagerMac(Profile* profile) { | 201 UserManagerMac::UserManagerMac(Profile* profile) { |
| 202 window_controller_.reset([[UserManagerWindowController alloc] | 202 window_controller_.reset([[UserManagerWindowController alloc] |
| 203 initWithProfile:profile withObserver:this]); | 203 initWithProfile:profile withObserver:this]); |
| 204 } | 204 } |
| 205 | 205 |
| 206 UserManagerMac::~UserManagerMac() { | 206 UserManagerMac::~UserManagerMac() { |
| 207 } | 207 } |
| 208 | 208 |
| 209 // static | 209 // static |
| 210 void UserManagerMac::OnGuestProfileCreated(Profile* guest_profile, | 210 void UserManagerMac::OnSystemProfileCreated(Profile* system_profile, |
| 211 const std::string& url) { | 211 const std::string& url) { |
| 212 DCHECK(!instance_); | 212 DCHECK(!instance_); |
| 213 instance_ = new UserManagerMac(guest_profile); | 213 instance_ = new UserManagerMac(system_profile); |
| 214 [instance_->window_controller() showURL:GURL(url)]; | 214 [instance_->window_controller() showURL:GURL(url)]; |
| 215 } | 215 } |
| 216 | 216 |
| 217 void UserManagerMac::WindowWasClosed() { | 217 void UserManagerMac::WindowWasClosed() { |
| 218 instance_ = NULL; | 218 instance_ = NULL; |
| 219 delete this; | 219 delete this; |
| 220 } | 220 } |
| OLD | NEW |