| Index: chrome/browser/profiles/profile_shortcut_manager_win.cc
|
| ===================================================================
|
| --- chrome/browser/profiles/profile_shortcut_manager_win.cc (revision 115334)
|
| +++ chrome/browser/profiles/profile_shortcut_manager_win.cc (working copy)
|
| @@ -215,10 +215,12 @@
|
| }
|
|
|
| void ProfileShortcutManagerWin::OnProfileAdded(
|
| - const string16& profile_name,
|
| - const string16& profile_base_dir,
|
| const FilePath& profile_path,
|
| - const gfx::Image* avatar_image) {
|
| + const string16& profile_base_dir) {
|
| + ProfileInfoCache& cache =
|
| + g_browser_process->profile_manager()->GetProfileInfoCache();
|
| + size_t index = cache.GetIndexOfProfileWithPath(profile_path);
|
| +
|
| // Launch task to add shortcut to desktop on Windows. If this is the very
|
| // first profile created, don't add the user name to the shortcut.
|
| // TODO(mirandac): respect master_preferences choice to create no shortcuts
|
| @@ -227,8 +229,9 @@
|
| {
|
| // We make a copy of the Image to ensure that the underlying image data is
|
| // AddRef'd, in case the original copy gets deleted.
|
| - gfx::Image* avatar_copy = avatar_image ?
|
| - new gfx::Image(*avatar_image) : NULL;
|
| + gfx::Image* avatar_copy =
|
| + new gfx::Image(cache.GetAvatarIconOfProfileAtIndex(index));
|
| + string16 profile_name = cache.GetNameOfProfileAtIndex(index);
|
| BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
|
| base::Bind(&CreateChromeDesktopShortcutForProfile,
|
| profile_name, profile_base_dir, profile_path,
|
| @@ -238,8 +241,6 @@
|
| // If this is the second existing multi-user account created, change the
|
| // original shortcut use the first profile's details (name, badge,
|
| // argument).
|
| - ProfileInfoCache& cache =
|
| - g_browser_process->profile_manager()->GetProfileInfoCache();
|
| if (cache.GetNumberOfProfiles() == 2) {
|
| // Get the index of the first profile, based on the index of the second
|
| // profile. It's either 0 or 1, whichever the second profile isn't.
|
| @@ -307,10 +308,6 @@
|
| if (cache.GetNumberOfProfiles() != 1)
|
| return;
|
|
|
| - // TODO(stevet): Now that we've sunk our fangs onto ProfileInfoCache, we
|
| - // should clean up the ProfileInfoCacheObserver interface and its users
|
| - // (including us) to not pass every parameter through and instead query the
|
| - // cache when needed.
|
| FilePath profile_path = cache.GetPathOfProfileAtIndex(0);
|
| string16 old_shortcut;
|
| string16 new_shortcut;
|
| @@ -354,10 +351,14 @@
|
| }
|
|
|
| void ProfileShortcutManagerWin::OnProfileAvatarChanged(
|
| - const string16& profile_name,
|
| - const string16& profile_base_dir,
|
| const FilePath& profile_path,
|
| - const gfx::Image* avatar_image) {
|
| + const string16& profile_base_dir) {
|
| + ProfileInfoCache& cache =
|
| + g_browser_process->profile_manager()->GetProfileInfoCache();
|
| + size_t index = cache.GetIndexOfProfileWithPath(profile_path);
|
| + string16 profile_name = cache.GetNameOfProfileAtIndex(index);
|
| + const gfx::Image& avatar_image = cache.GetAvatarIconOfProfileAtIndex(index);
|
| +
|
| // Launch task to change the icon of the desktop shortcut on windows.
|
| string16 new_shortcut;
|
| BrowserDistribution* dist = BrowserDistribution::GetDistribution();
|
| @@ -365,8 +366,7 @@
|
| &new_shortcut)) {
|
| // We make a copy of the Image to ensure that the underlying image data is
|
| // AddRef'd, in case the original copy gets deleted.
|
| - gfx::Image* avatar_copy = avatar_image ?
|
| - new gfx::Image(*avatar_image) : NULL;
|
| + gfx::Image* avatar_copy = new gfx::Image(avatar_image);
|
| BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
|
| base::Bind(&UpdateChromeDesktopShortcutForProfile,
|
| new_shortcut,
|
|
|