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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 - (void)windowWillClose:(NSNotification*)notification { | 180 - (void)windowWillClose:(NSNotification*)notification { |
181 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 181 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
182 DCHECK(userManagerObserver_); | 182 DCHECK(userManagerObserver_); |
183 userManagerObserver_->WindowWasClosed(); | 183 userManagerObserver_->WindowWasClosed(); |
184 } | 184 } |
185 | 185 |
186 @end | 186 @end |
187 | 187 |
188 | 188 |
| 189 // static |
189 void UserManager::Show( | 190 void UserManager::Show( |
190 const base::FilePath& profile_path_to_focus, | 191 const base::FilePath& profile_path_to_focus, |
191 profiles::UserManagerTutorialMode tutorial_mode, | 192 profiles::UserManagerTutorialMode tutorial_mode, |
192 profiles::UserManagerProfileSelected profile_open_action) { | 193 profiles::UserManagerProfileSelected profile_open_action) { |
193 DCHECK(profile_path_to_focus != ProfileManager::GetGuestProfilePath()); | 194 DCHECK(profile_path_to_focus != ProfileManager::GetGuestProfilePath()); |
194 | 195 |
195 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::OPEN_USER_MANAGER); | 196 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::OPEN_USER_MANAGER); |
196 if (instance_) { | 197 if (instance_) { |
197 // If there's a user manager window open already, just activate it. | 198 // If there's a user manager window open already, just activate it. |
198 [instance_->window_controller() show]; | 199 [instance_->window_controller() show]; |
(...skipping 11 matching lines...) Expand all Loading... |
210 | 211 |
211 // Create the guest profile, if necessary, and open the User Manager | 212 // Create the guest profile, if necessary, and open the User Manager |
212 // from the guest profile. | 213 // from the guest profile. |
213 profiles::CreateSystemProfileForUserManager( | 214 profiles::CreateSystemProfileForUserManager( |
214 profile_path_to_focus, | 215 profile_path_to_focus, |
215 tutorial_mode, | 216 tutorial_mode, |
216 profile_open_action, | 217 profile_open_action, |
217 base::Bind(&UserManagerMac::OnSystemProfileCreated, base::Time::Now())); | 218 base::Bind(&UserManagerMac::OnSystemProfileCreated, base::Time::Now())); |
218 } | 219 } |
219 | 220 |
| 221 // static |
220 void UserManager::Hide() { | 222 void UserManager::Hide() { |
221 if (instance_) | 223 if (instance_) |
222 [instance_->window_controller() close]; | 224 [instance_->window_controller() close]; |
223 } | 225 } |
224 | 226 |
| 227 // static |
225 bool UserManager::IsShowing() { | 228 bool UserManager::IsShowing() { |
226 return instance_ ? [instance_->window_controller() isVisible]: false; | 229 return instance_ ? [instance_->window_controller() isVisible]: false; |
227 } | 230 } |
228 | 231 |
| 232 // static |
229 void UserManager::OnUserManagerShown() { | 233 void UserManager::OnUserManagerShown() { |
230 if (instance_) | 234 if (instance_) |
231 instance_->LogTimeToOpen(); | 235 instance_->LogTimeToOpen(); |
232 } | 236 } |
233 | 237 |
| 238 // static |
| 239 void UserManager::ShowReauthDialog(content::BrowserContext* browser_context, |
| 240 const std::string& email) { |
| 241 // TODO(rogerta): See equivalent views implementation in user_manager_view.cc. |
| 242 } |
| 243 |
234 UserManagerMac::UserManagerMac(Profile* profile) { | 244 UserManagerMac::UserManagerMac(Profile* profile) { |
235 window_controller_.reset([[UserManagerWindowController alloc] | 245 window_controller_.reset([[UserManagerWindowController alloc] |
236 initWithProfile:profile withObserver:this]); | 246 initWithProfile:profile withObserver:this]); |
237 } | 247 } |
238 | 248 |
239 UserManagerMac::~UserManagerMac() { | 249 UserManagerMac::~UserManagerMac() { |
240 } | 250 } |
241 | 251 |
242 // static | 252 // static |
243 void UserManagerMac::OnSystemProfileCreated(const base::Time& start_time, | 253 void UserManagerMac::OnSystemProfileCreated(const base::Time& start_time, |
(...skipping 12 matching lines...) Expand all Loading... |
256 | 266 |
257 ProfileMetrics::LogTimeToOpenUserManager( | 267 ProfileMetrics::LogTimeToOpenUserManager( |
258 base::Time::Now() - user_manager_started_showing_); | 268 base::Time::Now() - user_manager_started_showing_); |
259 user_manager_started_showing_ = base::Time(); | 269 user_manager_started_showing_ = base::Time(); |
260 } | 270 } |
261 | 271 |
262 void UserManagerMac::WindowWasClosed() { | 272 void UserManagerMac::WindowWasClosed() { |
263 instance_ = NULL; | 273 instance_ = NULL; |
264 delete this; | 274 delete this; |
265 } | 275 } |
OLD | NEW |