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) { | |
|
noms (inactive)
2014/08/26 20:17:32
I don't think you need the profile_index as an arg
Mike Lerman
2014/08/27 14:11:38
The on_close_confirmed parameter of CloseAllBrowse
| |
| 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), | |
| 274 base::Bind(&BrowserList::DoNothing)); | |
| 269 } | 275 } |
| 270 } | 276 } |
| 271 | 277 |
| 278 void LockBrowserCloseSuccess(const size_t profile_index) { | |
| 279 ProfileInfoCache& cache = | |
| 280 g_browser_process->profile_manager()->GetProfileInfoCache(); | |
| 281 DCHECK_LT(profile_index, cache.GetNumberOfProfiles()); | |
| 282 | |
| 283 cache.SetProfileSigninRequiredAtIndex(profile_index, true); | |
| 284 chrome::ShowUserManager(cache.GetPathOfProfileAtIndex(profile_index)); | |
| 285 } | |
| 286 | |
| 272 void LockProfile(Profile* profile) { | 287 void LockProfile(Profile* profile) { |
| 273 DCHECK(profile); | 288 DCHECK(profile); |
| 274 ProfileInfoCache& cache = | 289 if (profile) { |
| 275 g_browser_process->profile_manager()->GetProfileInfoCache(); | 290 BrowserList::CloseAllBrowsersWithProfile(profile, |
| 276 | 291 base::Bind(&LockBrowserCloseSuccess), |
| 277 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); | 292 base::Bind(&BrowserList::DoNothing)); |
| 278 cache.SetProfileSigninRequiredAtIndex(index, true); | 293 } |
| 279 chrome::ShowUserManager(profile->GetPath()); | |
| 280 BrowserList::CloseAllBrowsersWithProfile(profile); | |
| 281 } | 294 } |
| 282 | 295 |
| 283 void CreateGuestProfileForUserManager( | 296 void CreateGuestProfileForUserManager( |
| 284 const base::FilePath& profile_path_to_focus, | 297 const base::FilePath& profile_path_to_focus, |
| 285 profiles::UserManagerTutorialMode tutorial_mode, | 298 profiles::UserManagerTutorialMode tutorial_mode, |
| 286 const base::Callback<void(Profile*, const std::string&)>& callback) { | 299 const base::Callback<void(Profile*, const std::string&)>& callback) { |
| 287 // Create the guest profile, if necessary, and open the User Manager | 300 // Create the guest profile, if necessary, and open the User Manager |
| 288 // from the guest profile. | 301 // from the guest profile. |
| 289 g_browser_process->profile_manager()->CreateProfileAsync( | 302 g_browser_process->profile_manager()->CreateProfileAsync( |
| 290 ProfileManager::GetGuestProfilePath(), | 303 ProfileManager::GetGuestProfilePath(), |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 case BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR: | 388 case BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR: |
| 376 *bubble_view_mode = BUBBLE_VIEW_MODE_PROFILE_CHOOSER; | 389 *bubble_view_mode = BUBBLE_VIEW_MODE_PROFILE_CHOOSER; |
| 377 *tutorial_mode = TUTORIAL_MODE_SHOW_ERROR; | 390 *tutorial_mode = TUTORIAL_MODE_SHOW_ERROR; |
| 378 return; | 391 return; |
| 379 default: | 392 default: |
| 380 *bubble_view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; | 393 *bubble_view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; |
| 381 } | 394 } |
| 382 } | 395 } |
| 383 | 396 |
| 384 } // namespace profiles | 397 } // namespace profiles |
| OLD | NEW |