OLD | NEW |
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/files/file_util.h" | 8 #include "base/files/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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 if (value == ProfileIsUsingDefaultAvatarAtIndex(index)) | 728 if (value == ProfileIsUsingDefaultAvatarAtIndex(index)) |
729 return; | 729 return; |
730 | 730 |
731 scoped_ptr<base::DictionaryValue> info( | 731 scoped_ptr<base::DictionaryValue> info( |
732 GetInfoForProfileAtIndex(index)->DeepCopy()); | 732 GetInfoForProfileAtIndex(index)->DeepCopy()); |
733 info->SetBoolean(kIsUsingDefaultAvatarKey, value); | 733 info->SetBoolean(kIsUsingDefaultAvatarKey, value); |
734 // This takes ownership of |info|. | 734 // This takes ownership of |info|. |
735 SetInfoForProfileAtIndex(index, info.release()); | 735 SetInfoForProfileAtIndex(index, info.release()); |
736 } | 736 } |
737 | 737 |
738 bool ProfileInfoCache::IsDefaultProfileName(const base::string16& name) { | 738 bool ProfileInfoCache::IsDefaultProfileName(const base::string16& name) const { |
739 // Check if it's a "First user" old-style name. | 739 // Check if it's a "First user" old-style name. |
740 if (name == l10n_util::GetStringUTF16(IDS_DEFAULT_PROFILE_NAME) || | 740 if (name == l10n_util::GetStringUTF16(IDS_DEFAULT_PROFILE_NAME) || |
741 name == l10n_util::GetStringUTF16(IDS_LEGACY_DEFAULT_PROFILE_NAME)) | 741 name == l10n_util::GetStringUTF16(IDS_LEGACY_DEFAULT_PROFILE_NAME)) |
742 return true; | 742 return true; |
743 | 743 |
744 // Check if it's one of the old-style profile names. | 744 // Check if it's one of the old-style profile names. |
745 for (size_t i = 0; i < arraysize(kDefaultNames); ++i) { | 745 for (size_t i = 0; i < arraysize(kDefaultNames); ++i) { |
746 if (name == l10n_util::GetStringUTF16(kDefaultNames[i])) | 746 if (name == l10n_util::GetStringUTF16(kDefaultNames[i])) |
747 return true; | 747 return true; |
748 } | 748 } |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 std::vector<base::FilePath>::const_iterator it; | 1098 std::vector<base::FilePath>::const_iterator it; |
1099 for (it = profiles_to_rename.begin(); it != profiles_to_rename.end(); ++it) { | 1099 for (it = profiles_to_rename.begin(); it != profiles_to_rename.end(); ++it) { |
1100 size_t profile_index = GetIndexOfProfileWithPath(*it); | 1100 size_t profile_index = GetIndexOfProfileWithPath(*it); |
1101 SetProfileIsUsingDefaultNameAtIndex(profile_index, true); | 1101 SetProfileIsUsingDefaultNameAtIndex(profile_index, true); |
1102 // This will assign a new "Person %d" type name and re-sort the cache. | 1102 // This will assign a new "Person %d" type name and re-sort the cache. |
1103 SetNameOfProfileAtIndex(profile_index, ChooseNameForNewProfile( | 1103 SetNameOfProfileAtIndex(profile_index, ChooseNameForNewProfile( |
1104 GetAvatarIconIndexOfProfileAtIndex(profile_index))); | 1104 GetAvatarIconIndexOfProfileAtIndex(profile_index))); |
1105 } | 1105 } |
1106 #endif | 1106 #endif |
1107 } | 1107 } |
OLD | NEW |