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

Unified Diff: chrome/browser/profiles/profile_window.cc

Issue 1913373002: Revert "Refactor ProfileInfoCache in most of c/b/profiles" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/profile_shortcut_manager_win.cc ('k') | chrome/browser/profiles/profiles_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_window.cc
diff --git a/chrome/browser/profiles/profile_window.cc b/chrome/browser/profiles/profile_window.cc
index e1227d886317cd3c3066b440193999bf23ad9d0e..0a416623dab61bd8d88e8e63d8db52da31f2de8c 100644
--- a/chrome/browser/profiles/profile_window.cc
+++ b/chrome/browser/profiles/profile_window.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/profiles/profile_window.h"
#include <stddef.h>
-
#include <string>
#include <vector>
@@ -19,8 +18,6 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/profiles/profile_attributes_entry.h"
-#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/signin/account_reconcilor_factory.h"
@@ -146,13 +143,12 @@ void OpenBrowserWindowForProfile(
// The signin bit will still be set if the profile is being unlocked and the
// browser window for it is opening. As part of this unlock process, unblock
// all the extensions.
- if (!profile->IsGuestSession()) {
- ProfileAttributesEntry* entry;
- if (g_browser_process->profile_manager()->GetProfileAttributesStorage().
- GetProfileAttributesWithPath(profile->GetPath(), &entry) &&
- entry->IsSigninRequired()) {
- UnblockExtensions(profile);
- }
+ const ProfileInfoCache& cache =
+ g_browser_process->profile_manager()->GetProfileInfoCache();
+ int index = cache.GetIndexOfProfileWithPath(profile->GetPath());
+ if (!profile->IsGuestSession() &&
+ cache.ProfileIsSigninRequiredAtIndex(index)) {
+ UnblockExtensions(profile);
}
#endif // defined(ENABLE_EXTENSIONS)
@@ -255,7 +251,7 @@ base::FilePath GetPathOfProfileWithEmail(ProfileManager* profile_manager,
const std::string& email) {
base::string16 profile_email = base::UTF8ToUTF16(email);
std::vector<ProfileAttributesEntry*> entries =
- profile_manager->GetProfileAttributesStorage().GetAllProfilesAttributes();
+ profile_manager->GetProfileInfoCache().GetAllProfilesAttributes();
for (ProfileAttributesEntry* entry : entries) {
if (entry->GetUserName() == profile_email)
return entry->GetPath();
@@ -319,12 +315,12 @@ bool HasProfileSwitchTargets(Profile* profile) {
void CreateAndSwitchToNewProfile(ProfileManager::CreateCallback callback,
ProfileMetrics::ProfileAdd metric) {
- ProfileAttributesStorage& storage =
- g_browser_process->profile_manager()->GetProfileAttributesStorage();
+ ProfileInfoCache& cache =
+ g_browser_process->profile_manager()->GetProfileInfoCache();
int placeholder_avatar_index = profiles::GetPlaceholderAvatarIndex();
ProfileManager::CreateMultiProfileAsync(
- storage.ChooseNameForNewProfile(placeholder_avatar_index),
+ cache.ChooseNameForNewProfile(placeholder_avatar_index),
profiles::GetDefaultAvatarIconUrl(placeholder_avatar_index),
base::Bind(&OpenBrowserWindowForProfile, callback, true, true),
std::string());
@@ -350,11 +346,10 @@ void CloseGuestProfileWindows() {
void LockBrowserCloseSuccess(const base::FilePath& profile_path) {
ProfileManager* profile_manager = g_browser_process->profile_manager();
- ProfileAttributesEntry* entry;
- bool has_entry = profile_manager->GetProfileAttributesStorage().
- GetProfileAttributesWithPath(profile_path, &entry);
- DCHECK(has_entry);
- entry->SetIsSigninRequired(true);
+ ProfileInfoCache* cache = &profile_manager->GetProfileInfoCache();
+
+ cache->SetProfileSigninRequiredAtIndex(
+ cache->GetIndexOfProfileWithPath(profile_path), true);
#if defined(ENABLE_EXTENSIONS)
// Profile guaranteed to exist for it to have been locked.
@@ -401,12 +396,10 @@ bool IsLockAvailable(Profile* profile) {
return false;
}
- // Lock only when there is at least one supervised user on the machine.
- std::vector<ProfileAttributesEntry*> entries =
- g_browser_process->profile_manager()->GetProfileAttributesStorage().
- GetAllProfilesAttributes();
- for (ProfileAttributesEntry* entry : entries) {
- if (entry->IsSupervised())
+ const ProfileInfoCache& cache =
+ g_browser_process->profile_manager()->GetProfileInfoCache();
+ for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) {
+ if (cache.ProfileIsSupervisedAtIndex(i))
return true;
}
return false;
« no previous file with comments | « chrome/browser/profiles/profile_shortcut_manager_win.cc ('k') | chrome/browser/profiles/profiles_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698