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

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

Issue 373093002: ProfileInfoCache: Notify observers of a name change on SetGAIAGivenNameOfProfileAtIndex. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 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/i18n/case_conversion.h" 9 #include "base/i18n/case_conversion.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 OnProfileNameChanged(profile_path, old_display_name)); 604 OnProfileNameChanged(profile_path, old_display_name));
605 } 605 }
606 } 606 }
607 607
608 void ProfileInfoCache::SetGAIAGivenNameOfProfileAtIndex( 608 void ProfileInfoCache::SetGAIAGivenNameOfProfileAtIndex(
609 size_t index, 609 size_t index,
610 const base::string16& name) { 610 const base::string16& name) {
611 if (name == GetGAIAGivenNameOfProfileAtIndex(index)) 611 if (name == GetGAIAGivenNameOfProfileAtIndex(index))
612 return; 612 return;
613 613
614 base::string16 old_display_name = GetNameOfProfileAtIndex(index);
614 scoped_ptr<base::DictionaryValue> info( 615 scoped_ptr<base::DictionaryValue> info(
615 GetInfoForProfileAtIndex(index)->DeepCopy()); 616 GetInfoForProfileAtIndex(index)->DeepCopy());
616 info->SetString(kGAIAGivenNameKey, name); 617 info->SetString(kGAIAGivenNameKey, name);
617 // This takes ownership of |info|. 618 // This takes ownership of |info|.
618 SetInfoForProfileAtIndex(index, info.release()); 619 SetInfoForProfileAtIndex(index, info.release());
620 base::string16 new_display_name = GetNameOfProfileAtIndex(index);
621 base::FilePath profile_path = GetPathOfProfileAtIndex(index);
622 UpdateSortForProfileIndex(index);
623
624 if (old_display_name != new_display_name) {
625 FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
626 observer_list_,
627 OnProfileNameChanged(profile_path, old_display_name));
628 }
619 } 629 }
620 630
621 void ProfileInfoCache::SetGAIAPictureOfProfileAtIndex(size_t index, 631 void ProfileInfoCache::SetGAIAPictureOfProfileAtIndex(size_t index,
622 const gfx::Image* image) { 632 const gfx::Image* image) {
623 base::FilePath path = GetPathOfProfileAtIndex(index); 633 base::FilePath path = GetPathOfProfileAtIndex(index);
624 std::string key = CacheKeyFromProfilePath(path); 634 std::string key = CacheKeyFromProfilePath(path);
625 635
626 // Delete the old bitmap from cache. 636 // Delete the old bitmap from cache.
627 std::map<std::string, gfx::Image*>::iterator it = 637 std::map<std::string, gfx::Image*>::iterator it =
628 cached_avatar_images_.find(key); 638 cached_avatar_images_.find(key);
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 OnProfileAvatarChanged(profile_path)); 1020 OnProfileAvatarChanged(profile_path));
1011 1021
1012 // Remove the file from the list of downloads in progress. Note that this list 1022 // Remove the file from the list of downloads in progress. Note that this list
1013 // only contains the high resolution avatars, and not the Gaia profile images. 1023 // only contains the high resolution avatars, and not the Gaia profile images.
1014 if (!avatar_images_downloads_in_progress_[file_name]) 1024 if (!avatar_images_downloads_in_progress_[file_name])
1015 return; 1025 return;
1016 1026
1017 delete avatar_images_downloads_in_progress_[file_name]; 1027 delete avatar_images_downloads_in_progress_[file_name];
1018 avatar_images_downloads_in_progress_[file_name] = NULL; 1028 avatar_images_downloads_in_progress_[file_name] = NULL;
1019 } 1029 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698