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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 } | 366 } |
367 | 367 |
368 void CloseGuestProfileWindows() { | 368 void CloseGuestProfileWindows() { |
369 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 369 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
370 Profile* profile = profile_manager->GetProfileByPath( | 370 Profile* profile = profile_manager->GetProfileByPath( |
371 ProfileManager::GetGuestProfilePath()); | 371 ProfileManager::GetGuestProfilePath()); |
372 | 372 |
373 if (profile) { | 373 if (profile) { |
374 BrowserList::CloseAllBrowsersWithProfile( | 374 BrowserList::CloseAllBrowsersWithProfile( |
375 profile, base::Bind(&ProfileBrowserCloseSuccess), | 375 profile, base::Bind(&ProfileBrowserCloseSuccess), |
376 BrowserList::CloseCallback()); | 376 BrowserList::CloseCallback(), false); |
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); |
387 | 387 |
388 #if BUILDFLAG(ENABLE_EXTENSIONS) | 388 #if BUILDFLAG(ENABLE_EXTENSIONS) |
389 // Profile guaranteed to exist for it to have been locked. | 389 // Profile guaranteed to exist for it to have been locked. |
390 BlockExtensions(profile_manager->GetProfileByPath(profile_path)); | 390 BlockExtensions(profile_manager->GetProfileByPath(profile_path)); |
391 #endif // BUILDFLAG(ENABLE_EXTENSIONS) | 391 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
392 | 392 |
393 chrome::HideTaskManager(); | 393 chrome::HideTaskManager(); |
394 UserManager::Show(profile_path, | 394 UserManager::Show(profile_path, |
395 profiles::USER_MANAGER_NO_TUTORIAL, | 395 profiles::USER_MANAGER_NO_TUTORIAL, |
396 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); | 396 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); |
397 } | 397 } |
398 | 398 |
399 void LockProfile(Profile* profile) { | 399 void LockProfile(Profile* profile) { |
400 DCHECK(profile); | 400 DCHECK(profile); |
401 if (profile) { | 401 if (profile) { |
402 BrowserList::CloseAllBrowsersWithProfile( | 402 BrowserList::CloseAllBrowsersWithProfile( |
403 profile, base::Bind(&LockBrowserCloseSuccess), | 403 profile, base::Bind(&LockBrowserCloseSuccess), |
404 BrowserList::CloseCallback()); | 404 BrowserList::CloseCallback(), false); |
405 } | 405 } |
406 } | 406 } |
407 | 407 |
408 bool IsLockAvailable(Profile* profile) { | 408 bool IsLockAvailable(Profile* profile) { |
409 DCHECK(profile); | 409 DCHECK(profile); |
410 if (!switches::IsNewProfileManagement()) | 410 if (!switches::IsNewProfileManagement()) |
411 return false; | 411 return false; |
412 | 412 |
413 if (profile->IsGuestSession() || profile->IsSystemProfile()) | 413 if (profile->IsGuestSession() || profile->IsSystemProfile()) |
414 return false; | 414 return false; |
(...skipping 24 matching lines...) Expand all Loading... |
439 if (entry->IsSupervised()) | 439 if (entry->IsSupervised()) |
440 return true; | 440 return true; |
441 } | 441 } |
442 return false; | 442 return false; |
443 } | 443 } |
444 | 444 |
445 void CloseProfileWindows(Profile* profile) { | 445 void CloseProfileWindows(Profile* profile) { |
446 DCHECK(profile); | 446 DCHECK(profile); |
447 BrowserList::CloseAllBrowsersWithProfile( | 447 BrowserList::CloseAllBrowsersWithProfile( |
448 profile, base::Bind(&ProfileBrowserCloseSuccess), | 448 profile, base::Bind(&ProfileBrowserCloseSuccess), |
449 BrowserList::CloseCallback()); | 449 BrowserList::CloseCallback(), false); |
450 } | 450 } |
451 | 451 |
452 void CreateSystemProfileForUserManager( | 452 void CreateSystemProfileForUserManager( |
453 const base::FilePath& profile_path_to_focus, | 453 const base::FilePath& profile_path_to_focus, |
454 profiles::UserManagerTutorialMode tutorial_mode, | 454 profiles::UserManagerTutorialMode tutorial_mode, |
455 profiles::UserManagerAction user_manager_action, | 455 profiles::UserManagerAction user_manager_action, |
456 const base::Callback<void(Profile*, const std::string&)>& callback) { | 456 const base::Callback<void(Profile*, const std::string&)>& callback) { |
457 // Create the system profile, if necessary, and open the User Manager | 457 // Create the system profile, if necessary, and open the User Manager |
458 // from the system profile. | 458 // from the system profile. |
459 g_browser_process->profile_manager()->CreateProfileAsync( | 459 g_browser_process->profile_manager()->CreateProfileAsync( |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 PrefService* local_state = g_browser_process->local_state(); | 531 PrefService* local_state = g_browser_process->local_state(); |
532 const bool dismissed = local_state->GetBoolean( | 532 const bool dismissed = local_state->GetBoolean( |
533 prefs::kProfileAvatarRightClickTutorialDismissed); | 533 prefs::kProfileAvatarRightClickTutorialDismissed); |
534 | 534 |
535 // Don't show the tutorial if it's already been dismissed or if right-clicking | 535 // Don't show the tutorial if it's already been dismissed or if right-clicking |
536 // wouldn't show any targets. | 536 // wouldn't show any targets. |
537 return !dismissed && HasProfileSwitchTargets(profile); | 537 return !dismissed && HasProfileSwitchTargets(profile); |
538 } | 538 } |
539 | 539 |
540 } // namespace profiles | 540 } // namespace profiles |
OLD | NEW |