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

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

Issue 7631027: Multi-Profiles: Add profile avatar if second profile is added (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/frame/opaque_browser_frame_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 std::string key = CacheKeyFromProfilePath(profile_path); 100 std::string key = CacheKeyFromProfilePath(profile_path);
101 DictionaryPrefUpdate update(prefs_, prefs::kProfileInfoCache); 101 DictionaryPrefUpdate update(prefs_, prefs::kProfileInfoCache);
102 DictionaryValue* cache = update.Get(); 102 DictionaryValue* cache = update.Get();
103 103
104 scoped_ptr<DictionaryValue> info(new DictionaryValue); 104 scoped_ptr<DictionaryValue> info(new DictionaryValue);
105 info->SetString(kNameKey, name); 105 info->SetString(kNameKey, name);
106 info->SetString(kAvatarIconKey, GetDefaultAvatarIconUrl(icon_index)); 106 info->SetString(kAvatarIconKey, GetDefaultAvatarIconUrl(icon_index));
107 cache->Set(key, info.release()); 107 cache->Set(key, info.release());
108 108
109 sorted_keys_.insert(FindPositionForProfile(key, name), key); 109 sorted_keys_.insert(FindPositionForProfile(key, name), key);
110
111 NotificationService::current()->Notify(
112 chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
113 NotificationService::AllSources(),
114 NotificationService::NoDetails());
110 } 115 }
111 116
112 void ProfileInfoCache::DeleteProfileFromCache(const FilePath& profile_path) { 117 void ProfileInfoCache::DeleteProfileFromCache(const FilePath& profile_path) {
113 DictionaryPrefUpdate update(prefs_, prefs::kProfileInfoCache); 118 DictionaryPrefUpdate update(prefs_, prefs::kProfileInfoCache);
114 DictionaryValue* cache = update.Get(); 119 DictionaryValue* cache = update.Get();
115 120
116 std::string key = CacheKeyFromProfilePath(profile_path); 121 std::string key = CacheKeyFromProfilePath(profile_path);
117 cache->Remove(key, NULL); 122 cache->Remove(key, NULL);
118 sorted_keys_.erase(std::find(sorted_keys_.begin(), sorted_keys_.end(), key)); 123 sorted_keys_.erase(std::find(sorted_keys_.begin(), sorted_keys_.end(), key));
119 124
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 if (key_compare < 0) 320 if (key_compare < 0)
316 return sorted_keys_.begin() + i; 321 return sorted_keys_.begin() + i;
317 } 322 }
318 } 323 }
319 return sorted_keys_.end(); 324 return sorted_keys_.end();
320 } 325 }
321 326
322 void ProfileInfoCache::RegisterPrefs(PrefService* prefs) { 327 void ProfileInfoCache::RegisterPrefs(PrefService* prefs) {
323 prefs->RegisterDictionaryPref(prefs::kProfileInfoCache); 328 prefs->RegisterDictionaryPref(prefs::kProfileInfoCache);
324 } 329 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/frame/opaque_browser_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698