| 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 "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
| 9 #include "chrome/browser/ui/browser_dialogs.h" | 9 #include "chrome/browser/ui/browser_dialogs.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 // static | 140 // static |
| 141 void UserManagerMac::Show(const base::FilePath& profile_path_to_focus, | 141 void UserManagerMac::Show(const base::FilePath& profile_path_to_focus, |
| 142 profiles::UserManagerTutorialMode tutorial_mode) { | 142 profiles::UserManagerTutorialMode tutorial_mode) { |
| 143 if (instance_) { | 143 if (instance_) { |
| 144 // If there's a user manager window open already, just activate it. | 144 // If there's a user manager window open already, just activate it. |
| 145 [instance_->window_controller_ show]; | 145 [instance_->window_controller_ show]; |
| 146 return; | 146 return; |
| 147 } | 147 } |
| 148 | 148 |
| 149 // Create the guest profile, if necessary, and open the User Manager | 149 // Create the User Manager profile, if necessary, and open the User Manager |
| 150 // from the guest profile. | 150 // when the profile is ready. |
| 151 profiles::CreateGuestProfileForUserManager( | 151 profiles::CreateUserManagerProfile( |
| 152 profile_path_to_focus, | 152 profile_path_to_focus, |
| 153 tutorial_mode, | 153 tutorial_mode, |
| 154 base::Bind(&UserManagerMac::OnGuestProfileCreated)); | 154 base::Bind(&UserManagerMac::OnUserManagerProfileCreated)); |
| 155 } | 155 } |
| 156 | 156 |
| 157 // static | 157 // static |
| 158 void UserManagerMac::Hide() { | 158 void UserManagerMac::Hide() { |
| 159 if (instance_) | 159 if (instance_) |
| 160 [instance_->window_controller_ close]; | 160 [instance_->window_controller_ close]; |
| 161 } | 161 } |
| 162 | 162 |
| 163 // static | 163 // static |
| 164 bool UserManagerMac::IsShowing() { | 164 bool UserManagerMac::IsShowing() { |
| 165 return instance_ ? [instance_->window_controller_ isVisible]: false; | 165 return instance_ ? [instance_->window_controller_ isVisible]: false; |
| 166 } | 166 } |
| 167 | 167 |
| 168 // static | 168 // static |
| 169 void UserManagerMac::OnGuestProfileCreated(Profile* guest_profile, | 169 void UserManagerMac::OnUserManagerProfileCreated(Profile* profile, |
| 170 const std::string& url) { | 170 const std::string& url) { |
| 171 instance_ = new UserManagerMac(guest_profile); | 171 instance_ = new UserManagerMac(profile); |
| 172 [instance_->window_controller_ showURL:GURL(url)]; | 172 [instance_->window_controller_ showURL:GURL(url)]; |
| 173 } | 173 } |
| 174 | 174 |
| 175 void UserManagerMac::WindowWasClosed() { | 175 void UserManagerMac::WindowWasClosed() { |
| 176 instance_ = NULL; | 176 instance_ = NULL; |
| 177 delete this; | 177 delete this; |
| 178 } | 178 } |
| OLD | NEW |