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

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

Issue 8226002: Multi-Profiles: Initialize sync user name when adding profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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) 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 info->GetString(kNameKey, &name); 90 info->GetString(kNameKey, &name);
91 sorted_keys_.insert(FindPositionForProfile(key, name), key); 91 sorted_keys_.insert(FindPositionForProfile(key, name), key);
92 } 92 }
93 } 93 }
94 94
95 ProfileInfoCache::~ProfileInfoCache() { 95 ProfileInfoCache::~ProfileInfoCache() {
96 } 96 }
97 97
98 void ProfileInfoCache::AddProfileToCache(const FilePath& profile_path, 98 void ProfileInfoCache::AddProfileToCache(const FilePath& profile_path,
99 const string16& name, 99 const string16& name,
100 const string16& username,
100 size_t icon_index) { 101 size_t icon_index) {
101 std::string key = CacheKeyFromProfilePath(profile_path); 102 std::string key = CacheKeyFromProfilePath(profile_path);
102 DictionaryPrefUpdate update(prefs_, prefs::kProfileInfoCache); 103 DictionaryPrefUpdate update(prefs_, prefs::kProfileInfoCache);
103 DictionaryValue* cache = update.Get(); 104 DictionaryValue* cache = update.Get();
104 105
105 scoped_ptr<DictionaryValue> info(new DictionaryValue); 106 scoped_ptr<DictionaryValue> info(new DictionaryValue);
106 info->SetString(kNameKey, name); 107 info->SetString(kNameKey, name);
108 info->SetString(kUserNameKey, username);
107 info->SetString(kAvatarIconKey, GetDefaultAvatarIconUrl(icon_index)); 109 info->SetString(kAvatarIconKey, GetDefaultAvatarIconUrl(icon_index));
108 cache->Set(key, info.release()); 110 cache->Set(key, info.release());
109 111
110 sorted_keys_.insert(FindPositionForProfile(key, name), key); 112 sorted_keys_.insert(FindPositionForProfile(key, name), key);
111 113
112 NotificationService::current()->Notify( 114 NotificationService::current()->Notify(
113 chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, 115 chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
114 NotificationService::AllSources(), 116 NotificationService::AllSources(),
115 NotificationService::NoDetails()); 117 NotificationService::NoDetails());
116 } 118 }
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 if (key_compare < 0) 337 if (key_compare < 0)
336 return sorted_keys_.begin() + i; 338 return sorted_keys_.begin() + i;
337 } 339 }
338 } 340 }
339 return sorted_keys_.end(); 341 return sorted_keys_.end();
340 } 342 }
341 343
342 void ProfileInfoCache::RegisterPrefs(PrefService* prefs) { 344 void ProfileInfoCache::RegisterPrefs(PrefService* prefs) {
343 prefs->RegisterDictionaryPref(prefs::kProfileInfoCache); 345 prefs->RegisterDictionaryPref(prefs::kProfileInfoCache);
344 } 346 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_info_cache.h ('k') | chrome/browser/profiles/profile_info_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698