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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 storage.ChooseNameForNewProfile(placeholder_avatar_index), | 353 storage.ChooseNameForNewProfile(placeholder_avatar_index), |
354 profiles::GetDefaultAvatarIconUrl(placeholder_avatar_index), | 354 profiles::GetDefaultAvatarIconUrl(placeholder_avatar_index), |
355 base::Bind(&profiles::OpenBrowserWindowForProfile, | 355 base::Bind(&profiles::OpenBrowserWindowForProfile, |
356 callback, | 356 callback, |
357 true, | 357 true, |
358 true), | 358 true), |
359 std::string()); | 359 std::string()); |
360 ProfileMetrics::LogProfileAddNewUser(metric); | 360 ProfileMetrics::LogProfileAddNewUser(metric); |
361 } | 361 } |
362 | 362 |
363 void GuestBrowserCloseSuccess(const base::FilePath& profile_path) { | 363 void ProfileBrowserCloseSuccess(const base::FilePath& profile_path) { |
364 UserManager::Show(base::FilePath(), | 364 UserManager::Show(base::FilePath(), |
365 profiles::USER_MANAGER_NO_TUTORIAL, | 365 profiles::USER_MANAGER_NO_TUTORIAL, |
366 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); | 366 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
367 } | 367 } |
368 | 368 |
369 void CloseGuestProfileWindows() { | 369 void CloseGuestProfileWindows() { |
370 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 370 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
371 Profile* profile = profile_manager->GetProfileByPath( | 371 Profile* profile = profile_manager->GetProfileByPath( |
372 ProfileManager::GetGuestProfilePath()); | 372 ProfileManager::GetGuestProfilePath()); |
373 | 373 |
374 if (profile) { | 374 if (profile) { |
375 BrowserList::CloseAllBrowsersWithProfile( | 375 BrowserList::CloseAllBrowsersWithProfile( |
376 profile, base::Bind(&GuestBrowserCloseSuccess)); | 376 profile, base::Bind(&ProfileBrowserCloseSuccess)); |
377 } | 377 } |
378 } | 378 } |
379 | 379 |
380 void LockBrowserCloseSuccess(const base::FilePath& profile_path) { | 380 void LockBrowserCloseSuccess(const base::FilePath& profile_path) { |
381 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 381 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
382 ProfileAttributesEntry* entry; | 382 ProfileAttributesEntry* entry; |
383 bool has_entry = profile_manager->GetProfileAttributesStorage(). | 383 bool has_entry = profile_manager->GetProfileAttributesStorage(). |
384 GetProfileAttributesWithPath(profile_path, &entry); | 384 GetProfileAttributesWithPath(profile_path, &entry); |
385 DCHECK(has_entry); | 385 DCHECK(has_entry); |
386 entry->SetIsSigninRequired(true); | 386 entry->SetIsSigninRequired(true); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 std::vector<ProfileAttributesEntry*> entries = | 434 std::vector<ProfileAttributesEntry*> entries = |
435 g_browser_process->profile_manager()->GetProfileAttributesStorage(). | 435 g_browser_process->profile_manager()->GetProfileAttributesStorage(). |
436 GetAllProfilesAttributes(); | 436 GetAllProfilesAttributes(); |
437 for (ProfileAttributesEntry* entry : entries) { | 437 for (ProfileAttributesEntry* entry : entries) { |
438 if (entry->IsSupervised()) | 438 if (entry->IsSupervised()) |
439 return true; | 439 return true; |
440 } | 440 } |
441 return false; | 441 return false; |
442 } | 442 } |
443 | 443 |
| 444 void CloseProfileWindows(Profile* profile) { |
| 445 DCHECK(profile); |
| 446 BrowserList::CloseAllBrowsersWithProfile( |
| 447 profile, base::Bind(&ProfileBrowserCloseSuccess)); |
| 448 } |
| 449 |
444 void CreateSystemProfileForUserManager( | 450 void CreateSystemProfileForUserManager( |
445 const base::FilePath& profile_path_to_focus, | 451 const base::FilePath& profile_path_to_focus, |
446 profiles::UserManagerTutorialMode tutorial_mode, | 452 profiles::UserManagerTutorialMode tutorial_mode, |
447 profiles::UserManagerProfileSelected profile_open_action, | 453 profiles::UserManagerProfileSelected profile_open_action, |
448 const base::Callback<void(Profile*, const std::string&)>& callback) { | 454 const base::Callback<void(Profile*, const std::string&)>& callback) { |
449 // Create the system profile, if necessary, and open the User Manager | 455 // Create the system profile, if necessary, and open the User Manager |
450 // from the system profile. | 456 // from the system profile. |
451 g_browser_process->profile_manager()->CreateProfileAsync( | 457 g_browser_process->profile_manager()->CreateProfileAsync( |
452 ProfileManager::GetSystemProfilePath(), | 458 ProfileManager::GetSystemProfilePath(), |
453 base::Bind(&OnUserManagerSystemProfileCreated, | 459 base::Bind(&OnUserManagerSystemProfileCreated, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 PrefService* local_state = g_browser_process->local_state(); | 529 PrefService* local_state = g_browser_process->local_state(); |
524 const bool dismissed = local_state->GetBoolean( | 530 const bool dismissed = local_state->GetBoolean( |
525 prefs::kProfileAvatarRightClickTutorialDismissed); | 531 prefs::kProfileAvatarRightClickTutorialDismissed); |
526 | 532 |
527 // Don't show the tutorial if it's already been dismissed or if right-clicking | 533 // Don't show the tutorial if it's already been dismissed or if right-clicking |
528 // wouldn't show any targets. | 534 // wouldn't show any targets. |
529 return !dismissed && HasProfileSwitchTargets(profile); | 535 return !dismissed && HasProfileSwitchTargets(profile); |
530 } | 536 } |
531 | 537 |
532 } // namespace profiles | 538 } // namespace profiles |
OLD | NEW |