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

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

Issue 2694813004: Upon deletion of the profile don't fallback on current if it supervised. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | 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 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 if (profile) { 1360 if (profile) {
1361 bool result = AddProfile(profile); 1361 bool result = AddProfile(profile);
1362 DCHECK(result); 1362 DCHECK(result);
1363 } 1363 }
1364 return profile; 1364 return profile;
1365 } 1365 }
1366 1366
1367 #if !defined(OS_ANDROID) 1367 #if !defined(OS_ANDROID)
1368 void ProfileManager::EnsureActiveProfileExistsBeforeDeletion( 1368 void ProfileManager::EnsureActiveProfileExistsBeforeDeletion(
1369 const CreateCallback& callback, const base::FilePath& profile_dir) { 1369 const CreateCallback& callback, const base::FilePath& profile_dir) {
1370 // In case we delete non-active profile, just proceed. 1370 // In case we delete non-active profile and current profile is valid, proceed.
1371 const base::FilePath last_used_profile = 1371 const base::FilePath last_used_profile_path =
1372 GetLastUsedProfileDir(user_data_dir_); 1372 GetLastUsedProfileDir(user_data_dir_);
1373 const base::FilePath guest_profile_path = GetGuestProfilePath(); 1373 const base::FilePath guest_profile_path = GetGuestProfilePath();
1374 if (last_used_profile != profile_dir && 1374 Profile* last_used_profile = GetProfileByPath(last_used_profile_path);
1375 last_used_profile != guest_profile_path) { 1375 if (last_used_profile_path != profile_dir &&
1376 FinishDeletingProfile(profile_dir, last_used_profile); 1376 last_used_profile_path != guest_profile_path &&
1377 last_used_profile != nullptr &&
1378 !last_used_profile->IsLegacySupervised()) {
1379 FinishDeletingProfile(profile_dir, last_used_profile_path);
1377 return; 1380 return;
1378 } 1381 }
1379 1382
1380 // Search for an active browser and use its profile as active if possible. 1383 // Search for an active browser and use its profile as active if possible.
1381 for (Browser* browser : *BrowserList::GetInstance()) { 1384 for (Browser* browser : *BrowserList::GetInstance()) {
1382 Profile* profile = browser->profile(); 1385 Profile* profile = browser->profile();
1383 base::FilePath cur_path = profile->GetPath(); 1386 base::FilePath cur_path = profile->GetPath();
1384 if (cur_path != profile_dir && 1387 if (cur_path != profile_dir &&
1385 cur_path != guest_profile_path && 1388 cur_path != guest_profile_path &&
1386 !profile->IsLegacySupervised() && 1389 !profile->IsLegacySupervised() &&
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1721 1724
1722 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path); 1725 FinishDeletingProfile(profile_to_delete_path, new_active_profile_path);
1723 if (!original_callback.is_null()) 1726 if (!original_callback.is_null())
1724 original_callback.Run(loaded_profile, status); 1727 original_callback.Run(loaded_profile, status);
1725 } 1728 }
1726 #endif // !defined(OS_ANDROID) 1729 #endif // !defined(OS_ANDROID)
1727 1730
1728 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 1731 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
1729 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { 1732 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) {
1730 } 1733 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698