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

Side by Side Diff: chrome/browser/profiles/profile_info_cache.cc

Issue 23528008: Don't use path expansion for profile dictionaries in LocalState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/profile_info_cache.h" 5 #include "chrome/browser/profiles/profile_info_cache.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/i18n/case_conversion.h" 10 #include "base/i18n/case_conversion.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 DictionaryPrefUpdate update(prefs_, prefs::kProfileInfoCache); 209 DictionaryPrefUpdate update(prefs_, prefs::kProfileInfoCache);
210 DictionaryValue* cache = update.Get(); 210 DictionaryValue* cache = update.Get();
211 211
212 scoped_ptr<DictionaryValue> info(new DictionaryValue); 212 scoped_ptr<DictionaryValue> info(new DictionaryValue);
213 info->SetString(kNameKey, name); 213 info->SetString(kNameKey, name);
214 info->SetString(kUserNameKey, username); 214 info->SetString(kUserNameKey, username);
215 info->SetString(kAvatarIconKey, GetDefaultAvatarIconUrl(icon_index)); 215 info->SetString(kAvatarIconKey, GetDefaultAvatarIconUrl(icon_index));
216 // Default value for whether background apps are running is false. 216 // Default value for whether background apps are running is false.
217 info->SetBoolean(kBackgroundAppsKey, false); 217 info->SetBoolean(kBackgroundAppsKey, false);
218 info->SetString(kManagedUserId, managed_user_id); 218 info->SetString(kManagedUserId, managed_user_id);
219 cache->Set(key, info.release()); 219 cache->SetWithoutPathExpansion(key, info.release());
220 220
221 sorted_keys_.insert(FindPositionForProfile(key, name), key); 221 sorted_keys_.insert(FindPositionForProfile(key, name), key);
222 222
223 FOR_EACH_OBSERVER(ProfileInfoCacheObserver, 223 FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
224 observer_list_, 224 observer_list_,
225 OnProfileAdded(profile_path)); 225 OnProfileAdded(profile_path));
226 226
227 content::NotificationService::current()->Notify( 227 content::NotificationService::current()->Notify(
228 chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, 228 chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
229 content::NotificationService::AllSources(), 229 content::NotificationService::AllSources(),
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 800
801 return false; 801 return false;
802 } 802 }
803 803
804 const DictionaryValue* ProfileInfoCache::GetInfoForProfileAtIndex( 804 const DictionaryValue* ProfileInfoCache::GetInfoForProfileAtIndex(
805 size_t index) const { 805 size_t index) const {
806 DCHECK_LT(index, GetNumberOfProfiles()); 806 DCHECK_LT(index, GetNumberOfProfiles());
807 const DictionaryValue* cache = 807 const DictionaryValue* cache =
808 prefs_->GetDictionary(prefs::kProfileInfoCache); 808 prefs_->GetDictionary(prefs::kProfileInfoCache);
809 const DictionaryValue* info = NULL; 809 const DictionaryValue* info = NULL;
810 cache->GetDictionary(sorted_keys_[index], &info); 810 cache->GetDictionaryWithoutPathExpansion(sorted_keys_[index], &info);
811 return info; 811 return info;
812 } 812 }
813 813
814 void ProfileInfoCache::SetInfoForProfileAtIndex(size_t index, 814 void ProfileInfoCache::SetInfoForProfileAtIndex(size_t index,
815 DictionaryValue* info) { 815 DictionaryValue* info) {
816 DictionaryPrefUpdate update(prefs_, prefs::kProfileInfoCache); 816 DictionaryPrefUpdate update(prefs_, prefs::kProfileInfoCache);
817 DictionaryValue* cache = update.Get(); 817 DictionaryValue* cache = update.Get();
818 cache->Set(sorted_keys_[index], info); 818 cache->SetWithoutPathExpansion(sorted_keys_[index], info);
819 819
820 content::NotificationService::current()->Notify( 820 content::NotificationService::current()->Notify(
821 chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, 821 chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
822 content::NotificationService::AllSources(), 822 content::NotificationService::AllSources(),
823 content::NotificationService::NoDetails()); 823 content::NotificationService::NoDetails());
824 } 824 }
825 825
826 std::string ProfileInfoCache::CacheKeyFromProfilePath( 826 std::string ProfileInfoCache::CacheKeyFromProfilePath(
827 const base::FilePath& profile_path) const { 827 const base::FilePath& profile_path) const {
828 DCHECK(user_data_dir_ == profile_path.DirName()); 828 DCHECK(user_data_dir_ == profile_path.DirName());
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 info->GetString(kNameKey, &name); 879 info->GetString(kNameKey, &name);
880 names.push_back(name); 880 names.push_back(name);
881 } 881 }
882 return names; 882 return names;
883 } 883 }
884 884
885 // static 885 // static
886 void ProfileInfoCache::RegisterPrefs(PrefRegistrySimple* registry) { 886 void ProfileInfoCache::RegisterPrefs(PrefRegistrySimple* registry) {
887 registry->RegisterDictionaryPref(prefs::kProfileInfoCache); 887 registry->RegisterDictionaryPref(prefs::kProfileInfoCache);
888 } 888 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_metrics_service_unittest.cc ('k') | chrome/browser/profiles/profile_info_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698