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

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

Issue 2025433002: MD User Manager: Display error message when all profiles are locked. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comment Created 4 years, 6 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 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/profiles_state.h" 5 #include "chrome/browser/profiles/profiles_state.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // We should never be saving the System Profile as the last one used since it 249 // We should never be saving the System Profile as the last one used since it
250 // shouldn't have a browser. 250 // shouldn't have a browser.
251 if (profile_dir == base::FilePath(chrome::kSystemProfileDir).AsUTF8Unsafe()) 251 if (profile_dir == base::FilePath(chrome::kSystemProfileDir).AsUTF8Unsafe())
252 return; 252 return;
253 253
254 PrefService* local_state = g_browser_process->local_state(); 254 PrefService* local_state = g_browser_process->local_state();
255 DCHECK(local_state); 255 DCHECK(local_state);
256 local_state->SetString(prefs::kProfileLastUsed, profile_dir); 256 local_state->SetString(prefs::kProfileLastUsed, profile_dir);
257 } 257 }
258 258
259 bool AreAllProfilesLocked() {
260 bool all_profiles_locked = true;
261
262 std::vector<ProfileAttributesEntry*> entries =
263 g_browser_process->profile_manager()->GetProfileAttributesStorage().
264 GetAllProfilesAttributes();
265 for (const ProfileAttributesEntry* entry : entries) {
266 if (entry->IsOmitted())
267 continue;
268
269 // Supervised and Child profiles cannot be locked.
270 if (!entry->IsSigninRequired() &&
271 !entry->IsChild() &&
272 !entry->IsLegacySupervised()) {
273 return false;
274 }
275 }
276 return all_profiles_locked;
277 }
278
259 } // namespace profiles 279 } // namespace profiles
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profiles_state.h ('k') | chrome/browser/resources/md_user_manager/compiled_resources2.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698