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

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

Issue 2240823003: Avoid a crash in ProfileManager::GetLastUsedProfileAllowedByPolicy() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: schedule next refresh Created 4 years, 4 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
« no previous file with comments | « chrome/browser/media/tab_desktop_media_list.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 364
365 // static 365 // static
366 Profile* ProfileManager::GetLastUsedProfile() { 366 Profile* ProfileManager::GetLastUsedProfile() {
367 ProfileManager* profile_manager = g_browser_process->profile_manager(); 367 ProfileManager* profile_manager = g_browser_process->profile_manager();
368 return profile_manager->GetLastUsedProfile(profile_manager->user_data_dir_); 368 return profile_manager->GetLastUsedProfile(profile_manager->user_data_dir_);
369 } 369 }
370 370
371 // static 371 // static
372 Profile* ProfileManager::GetLastUsedProfileAllowedByPolicy() { 372 Profile* ProfileManager::GetLastUsedProfileAllowedByPolicy() {
373 Profile* profile = GetLastUsedProfile(); 373 Profile* profile = GetLastUsedProfile();
374 if (!profile)
375 return nullptr;
374 if (IncognitoModeForced(profile)) 376 if (IncognitoModeForced(profile))
375 return profile->GetOffTheRecordProfile(); 377 return profile->GetOffTheRecordProfile();
376 return profile; 378 return profile;
377 } 379 }
378 380
379 // static 381 // static
380 bool ProfileManager::IncognitoModeForced(Profile* profile) { 382 bool ProfileManager::IncognitoModeForced(Profile* profile) {
381 return profile->IsGuestSession() || 383 return profile->IsGuestSession() ||
382 profile->IsSystemProfile() || 384 profile->IsSystemProfile() ||
383 IncognitoModePrefs::GetAvailability(profile->GetPrefs()) == 385 IncognitoModePrefs::GetAvailability(profile->GetPrefs()) ==
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1647 1649
1648 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); 1650 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path);
1649 if (!original_callback.is_null()) 1651 if (!original_callback.is_null())
1650 original_callback.Run(loaded_profile, status); 1652 original_callback.Run(loaded_profile, status);
1651 } 1653 }
1652 #endif // !defined(OS_ANDROID) 1654 #endif // !defined(OS_ANDROID)
1653 1655
1654 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 1656 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
1655 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { 1657 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) {
1656 } 1658 }
OLDNEW
« no previous file with comments | « chrome/browser/media/tab_desktop_media_list.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698