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

Unified Diff: chrome/browser/ui/app_list/app_list_service_impl.cc

Issue 1631373003: Refactor ProfileInfoCache in c/b/ui/app_list (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to comments, add sorting of ProfileAttributesEntry Created 4 years, 11 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
Index: chrome/browser/ui/app_list/app_list_service_impl.cc
diff --git a/chrome/browser/ui/app_list/app_list_service_impl.cc b/chrome/browser/ui/app_list/app_list_service_impl.cc
index edd50463ccb7ecb9e166ed8e9125a5e8ea3be41d..fcd9f471beecb637c271943aff3a519db8067ef6 100644
--- a/chrome/browser/ui/app_list/app_list_service_impl.cc
+++ b/chrome/browser/ui/app_list/app_list_service_impl.cc
@@ -20,6 +20,7 @@
#include "base/time/time.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_shutdown.h"
+#include "chrome/browser/profiles/profile_attributes_entry.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/app_list/app_list_view_delegate.h"
#include "chrome/browser/ui/app_list/profile_loader.h"
@@ -93,8 +94,9 @@ class ProfileStoreImpl : public ProfileStore {
weak_factory_(this) {
}
- void AddProfileObserver(ProfileInfoCacheObserver* observer) override {
- profile_manager_->GetProfileInfoCache().AddObserver(observer);
+ void AddProfileObserver(ProfileAttributesStorage::Observer* observer)
+ override {
+ profile_manager_->GetProfileAttributesStorage().AddObserver(observer);
}
void LoadProfileAsync(const base::FilePath& path,
@@ -142,19 +144,19 @@ class ProfileStoreImpl : public ProfileStore {
}
bool IsProfileSupervised(const base::FilePath& profile_path) override {
- ProfileInfoCache& profile_info =
- g_browser_process->profile_manager()->GetProfileInfoCache();
- size_t profile_index = profile_info.GetIndexOfProfileWithPath(profile_path);
- return profile_index != std::string::npos &&
- profile_info.ProfileIsSupervisedAtIndex(profile_index);
+ ProfileAttributesEntry* entry = nullptr;
+ bool has_entry = g_browser_process->profile_manager()->
+ GetProfileAttributesStorage().
+ GetProfileAttributesWithPath(profile_path, &entry);
+ return has_entry && entry->IsSupervised();
}
bool IsProfileLocked(const base::FilePath& profile_path) override {
- ProfileInfoCache& profile_info =
- g_browser_process->profile_manager()->GetProfileInfoCache();
- size_t profile_index = profile_info.GetIndexOfProfileWithPath(profile_path);
- return profile_index != std::string::npos &&
- profile_info.ProfileIsSigninRequiredAtIndex(profile_index);
+ ProfileAttributesEntry* entry = nullptr;
+ bool has_entry = g_browser_process->profile_manager()->
+ GetProfileAttributesStorage().
+ GetProfileAttributesWithPath(profile_path, &entry);
+ return has_entry && entry->IsSigninRequired();
}
private:
@@ -342,7 +344,7 @@ void AppListServiceImpl::OnProfileWillBeRemoved(
return;
// Switch the app list over to a valid profile.
- // Before ProfileInfoCache::DeleteProfileFromCache() calls this function,
+ // Before ProfileAttributesStorage::RemoveProfile() calls this function,
// ProfileManager::ScheduleProfileForDeletion() will have checked to see if
// the deleted profile was also "last used", and updated that setting with
// something valid.

Powered by Google App Engine
This is Rietveld 408576698