Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/profiles/profile_window.h" | 5 #include "chrome/browser/profiles/profile_window.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 252 placeholder_avatar_index)), | 252 placeholder_avatar_index)), |
| 253 base::Bind(&OpenBrowserWindowForProfile, | 253 base::Bind(&OpenBrowserWindowForProfile, |
| 254 callback, | 254 callback, |
| 255 true, | 255 true, |
| 256 true, | 256 true, |
| 257 desktop_type), | 257 desktop_type), |
| 258 std::string()); | 258 std::string()); |
| 259 ProfileMetrics::LogProfileAddNewUser(metric); | 259 ProfileMetrics::LogProfileAddNewUser(metric); |
| 260 } | 260 } |
| 261 | 261 |
| 262 void GuestBrowserCloseSuccess(const size_t profile_index) { | |
| 263 chrome::ShowUserManager(base::FilePath()); | |
| 264 } | |
| 265 | |
| 262 void CloseGuestProfileWindows() { | 266 void CloseGuestProfileWindows() { |
| 263 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 267 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 264 Profile* profile = profile_manager->GetProfileByPath( | 268 Profile* profile = profile_manager->GetProfileByPath( |
| 265 ProfileManager::GetGuestProfilePath()); | 269 ProfileManager::GetGuestProfilePath()); |
| 266 | 270 |
| 267 if (profile) { | 271 if (profile) { |
| 268 BrowserList::CloseAllBrowsersWithProfile(profile); | 272 BrowserList::CloseAllBrowsersWithProfile(profile, |
| 273 base::Bind(&GuestBrowserCloseSuccess)); | |
|
Peter Kasting
2014/08/28 18:46:12
Nit: All lines of args should be aligned (multiple
Mike Lerman
2014/08/29 18:02:20
Done.
| |
| 269 } | 274 } |
| 270 } | 275 } |
| 271 | 276 |
| 277 void LockBrowserCloseSuccess(const size_t profile_index) { | |
|
noms (inactive)
2014/08/28 19:22:29
I think it would be better if this took the profil
Mike Lerman
2014/08/29 18:02:21
Done.
| |
| 278 ProfileInfoCache& cache = | |
|
Peter Kasting
2014/08/28 18:46:12
Nit: Use pointers or const refs rather than non-co
Mike Lerman
2014/08/29 18:02:20
Done.
| |
| 279 g_browser_process->profile_manager()->GetProfileInfoCache(); | |
| 280 DCHECK_LT(profile_index, cache.GetNumberOfProfiles()); | |
| 281 | |
| 282 cache.SetProfileSigninRequiredAtIndex(profile_index, true); | |
| 283 chrome::ShowUserManager(cache.GetPathOfProfileAtIndex(profile_index)); | |
| 284 } | |
| 285 | |
| 272 void LockProfile(Profile* profile) { | 286 void LockProfile(Profile* profile) { |
| 273 DCHECK(profile); | 287 DCHECK(profile); |
| 274 ProfileInfoCache& cache = | 288 if (profile) { |
| 275 g_browser_process->profile_manager()->GetProfileInfoCache(); | 289 BrowserList::CloseAllBrowsersWithProfile(profile, |
| 276 | 290 base::Bind(&LockBrowserCloseSuccess)); |
| 277 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); | 291 } |
| 278 cache.SetProfileSigninRequiredAtIndex(index, true); | |
| 279 chrome::ShowUserManager(profile->GetPath()); | |
| 280 BrowserList::CloseAllBrowsersWithProfile(profile); | |
| 281 } | 292 } |
| 282 | 293 |
| 283 void CreateGuestProfileForUserManager( | 294 void CreateGuestProfileForUserManager( |
| 284 const base::FilePath& profile_path_to_focus, | 295 const base::FilePath& profile_path_to_focus, |
| 285 profiles::UserManagerTutorialMode tutorial_mode, | 296 profiles::UserManagerTutorialMode tutorial_mode, |
| 286 const base::Callback<void(Profile*, const std::string&)>& callback) { | 297 const base::Callback<void(Profile*, const std::string&)>& callback) { |
| 287 // Create the guest profile, if necessary, and open the User Manager | 298 // Create the guest profile, if necessary, and open the User Manager |
| 288 // from the guest profile. | 299 // from the guest profile. |
| 289 g_browser_process->profile_manager()->CreateProfileAsync( | 300 g_browser_process->profile_manager()->CreateProfileAsync( |
| 290 ProfileManager::GetGuestProfilePath(), | 301 ProfileManager::GetGuestProfilePath(), |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 case BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR: | 386 case BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR: |
| 376 *bubble_view_mode = BUBBLE_VIEW_MODE_PROFILE_CHOOSER; | 387 *bubble_view_mode = BUBBLE_VIEW_MODE_PROFILE_CHOOSER; |
| 377 *tutorial_mode = TUTORIAL_MODE_SHOW_ERROR; | 388 *tutorial_mode = TUTORIAL_MODE_SHOW_ERROR; |
| 378 return; | 389 return; |
| 379 default: | 390 default: |
| 380 *bubble_view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; | 391 *bubble_view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; |
| 381 } | 392 } |
| 382 } | 393 } |
| 383 | 394 |
| 384 } // namespace profiles | 395 } // namespace profiles |
| OLD | NEW |