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

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: Notify when deleting profile from cache 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 a3c9b319f58bc664331996a5571e7d966033400b..6f4897810b741a3d8e35fa995eb74edcaf62d37d 100644
--- a/chrome/browser/profiles/profile_info_cache.cc
+++ b/chrome/browser/profiles/profile_info_cache.cc
@@ -37,27 +37,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,
@@ -103,6 +82,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(
sail 2011/07/19 19:39:50 Good catch. Can you add this to AddProfileToCache
+ chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
+ NotificationService::AllSources(),
+ NotificationService::NoDetails());
}
size_t ProfileInfoCache::GetNumberOfProfiles() const {
@@ -228,6 +212,26 @@ std::string ProfileInfoCache::GetDefaultAvatarIconUrl(size_t index) {
return StringPrintf("%s%" PRIuS, kDefaultUrlPrefix, index);
}
+bool ProfileInfoCache::IsDefaultAvatarIconUrl(const std::string& url,
Miranda Callahan 2011/07/19 20:40:55 nit: could you put "// static" above this method s
+ 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());

Powered by Google App Engine
This is Rietveld 408576698