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/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 Loading... |
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 |
OLD | NEW |