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

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

Issue 7400032: Multi-profile WebUI settings (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: profiles_icon_list.js -> profiles_icon_grid.js Created 9 years, 5 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/profiles/profile_info_cache.cc
diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc
index 95ba7ff63cb1fda4f104f45ac7fcf7d5e8bed8af..efa3e6451674b057b61610d98953d978271d1f7a 100644
--- a/chrome/browser/profiles/profile_info_cache.cc
+++ b/chrome/browser/profiles/profile_info_cache.cc
@@ -43,27 +43,6 @@ const int kDefaultAvatarIconResources[] = {
const size_t kDefaultAvatarIconsCount = arraysize(kDefaultAvatarIconResources);
-// Checks if the given URL points to one of the default avatar icons. if it is,
-// returns true and its index through |icon_index|. If not, returns false.
-bool IsDefaultAvatarIconUrl(const std::string& url, size_t* icon_index) {
- DCHECK(icon_index);
- if (url.find(kDefaultUrlPrefix) != 0)
- return false;
-
- int int_value = -1;
- if (base::StringToInt(url.begin() + strlen(kDefaultUrlPrefix),
- url.end(),
- &int_value)) {
- if (int_value < 0 ||
- int_value >= static_cast<int>(kDefaultAvatarIconsCount))
- return false;
- *icon_index = int_value;
- return true;
- }
-
- return false;
-}
-
} // namespace
ProfileInfoCache::ProfileInfoCache(PrefService* prefs,
@@ -109,6 +88,11 @@ void ProfileInfoCache::DeleteProfileFromCache(const FilePath& profile_path) {
std::string key = CacheKeyFromProfilePath(profile_path);
cache->Remove(key, NULL);
sorted_keys_.erase(std::find(sorted_keys_.begin(), sorted_keys_.end(), key));
+
+ NotificationService::current()->Notify(
+ chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
+ NotificationService::AllSources(),
+ NotificationService::NoDetails());
}
size_t ProfileInfoCache::GetNumberOfProfiles() const {
@@ -220,20 +204,44 @@ const FilePath& ProfileInfoCache::GetUserDataDir() const {
return user_data_dir_;
}
+// static
size_t ProfileInfoCache::GetDefaultAvatarIconCount() {
return kDefaultAvatarIconsCount;
}
+// static
int ProfileInfoCache::GetDefaultAvatarIconResourceIDAtIndex(size_t index) {
DCHECK_LT(index, GetDefaultAvatarIconCount());
return kDefaultAvatarIconResources[index];
}
+// static
std::string ProfileInfoCache::GetDefaultAvatarIconUrl(size_t index) {
DCHECK_LT(index, kDefaultAvatarIconsCount);
return StringPrintf("%s%" PRIuS, kDefaultUrlPrefix, index);
}
+// static
+bool ProfileInfoCache::IsDefaultAvatarIconUrl(const std::string& url,
+ size_t* icon_index) {
+ DCHECK(icon_index);
+ if (url.find(kDefaultUrlPrefix) != 0)
+ return false;
+
+ int int_value = -1;
+ if (base::StringToInt(url.begin() + strlen(kDefaultUrlPrefix),
+ url.end(),
+ &int_value)) {
+ if (int_value < 0 ||
+ int_value >= static_cast<int>(kDefaultAvatarIconsCount))
+ return false;
+ *icon_index = int_value;
+ return true;
+ }
+
+ return false;
+}
+
const DictionaryValue* ProfileInfoCache::GetInfoForProfileAtIndex(
size_t index) const {
DCHECK_LT(index, GetNumberOfProfiles());
« no previous file with comments | « chrome/browser/profiles/profile_info_cache.h ('k') | chrome/browser/resources/options/manage_profile_overlay.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698