Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: chrome/browser/profiles/profile_manager.cc

Issue 1968703002: MD User Manager: Creates new browser window for last active profile if one is not available (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comment Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_manager.h" 5 #include "chrome/browser/profiles/profile_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 347
348 // static 348 // static
349 Profile* ProfileManager::GetLastUsedProfile() { 349 Profile* ProfileManager::GetLastUsedProfile() {
350 ProfileManager* profile_manager = g_browser_process->profile_manager(); 350 ProfileManager* profile_manager = g_browser_process->profile_manager();
351 return profile_manager->GetLastUsedProfile(profile_manager->user_data_dir_); 351 return profile_manager->GetLastUsedProfile(profile_manager->user_data_dir_);
352 } 352 }
353 353
354 // static 354 // static
355 Profile* ProfileManager::GetLastUsedProfileAllowedByPolicy() { 355 Profile* ProfileManager::GetLastUsedProfileAllowedByPolicy() {
356 Profile* profile = GetLastUsedProfile(); 356 Profile* profile = GetLastUsedProfile();
357 if (profile->IsGuestSession() || 357 if (IncognitoModeForced(profile))
358 profile->IsSystemProfile() ||
359 IncognitoModePrefs::GetAvailability(profile->GetPrefs()) ==
360 IncognitoModePrefs::FORCED) {
361 return profile->GetOffTheRecordProfile(); 358 return profile->GetOffTheRecordProfile();
362 }
363 return profile; 359 return profile;
364 } 360 }
365 361
366 // static 362 // static
363 bool ProfileManager::IncognitoModeForced(Profile* profile) {
364 return profile->IsGuestSession() ||
365 profile->IsSystemProfile() ||
366 IncognitoModePrefs::GetAvailability(profile->GetPrefs()) ==
367 IncognitoModePrefs::FORCED;
368 }
369
370 // static
367 std::vector<Profile*> ProfileManager::GetLastOpenedProfiles() { 371 std::vector<Profile*> ProfileManager::GetLastOpenedProfiles() {
368 ProfileManager* profile_manager = g_browser_process->profile_manager(); 372 ProfileManager* profile_manager = g_browser_process->profile_manager();
369 return profile_manager->GetLastOpenedProfiles( 373 return profile_manager->GetLastOpenedProfiles(
370 profile_manager->user_data_dir_); 374 profile_manager->user_data_dir_);
371 } 375 }
372 376
373 // static 377 // static
374 Profile* ProfileManager::GetPrimaryUserProfile() { 378 Profile* ProfileManager::GetPrimaryUserProfile() {
375 ProfileManager* profile_manager = g_browser_process->profile_manager(); 379 ProfileManager* profile_manager = g_browser_process->profile_manager();
376 #if defined(OS_CHROMEOS) 380 #if defined(OS_CHROMEOS)
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 1628
1625 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); 1629 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path);
1626 if (!original_callback.is_null()) 1630 if (!original_callback.is_null())
1627 original_callback.Run(loaded_profile, status); 1631 original_callback.Run(loaded_profile, status);
1628 } 1632 }
1629 #endif // !defined(OS_ANDROID) 1633 #endif // !defined(OS_ANDROID)
1630 1634
1631 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 1635 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
1632 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { 1636 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) {
1633 } 1637 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | chrome/browser/ui/webui/signin/signin_supervised_user_import_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698