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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 | 555 |
556 void ProfileInfoCache::SetIsOmittedProfileAtIndex(size_t index, | 556 void ProfileInfoCache::SetIsOmittedProfileAtIndex(size_t index, |
557 bool is_omitted) { | 557 bool is_omitted) { |
558 if (IsOmittedProfileAtIndex(index) == is_omitted) | 558 if (IsOmittedProfileAtIndex(index) == is_omitted) |
559 return; | 559 return; |
560 scoped_ptr<base::DictionaryValue> info( | 560 scoped_ptr<base::DictionaryValue> info( |
561 GetInfoForProfileAtIndex(index)->DeepCopy()); | 561 GetInfoForProfileAtIndex(index)->DeepCopy()); |
562 info->SetBoolean(kIsOmittedFromProfileListKey, is_omitted); | 562 info->SetBoolean(kIsOmittedFromProfileListKey, is_omitted); |
563 // This takes ownership of |info|. | 563 // This takes ownership of |info|. |
564 SetInfoForProfileAtIndex(index, info.release()); | 564 SetInfoForProfileAtIndex(index, info.release()); |
| 565 |
| 566 base::FilePath profile_path = GetPathOfProfileAtIndex(index); |
| 567 FOR_EACH_OBSERVER(ProfileInfoCacheObserver, |
| 568 observer_list_, |
| 569 OnProfileIsOmittedChanged(profile_path)); |
565 } | 570 } |
566 | 571 |
567 void ProfileInfoCache::SetSupervisedUserIdOfProfileAtIndex( | 572 void ProfileInfoCache::SetSupervisedUserIdOfProfileAtIndex( |
568 size_t index, | 573 size_t index, |
569 const std::string& id) { | 574 const std::string& id) { |
570 if (GetSupervisedUserIdOfProfileAtIndex(index) == id) | 575 if (GetSupervisedUserIdOfProfileAtIndex(index) == id) |
571 return; | 576 return; |
572 scoped_ptr<base::DictionaryValue> info( | 577 scoped_ptr<base::DictionaryValue> info( |
573 GetInfoForProfileAtIndex(index)->DeepCopy()); | 578 GetInfoForProfileAtIndex(index)->DeepCopy()); |
574 info->SetString(kSupervisedUserId, id); | 579 info->SetString(kSupervisedUserId, id); |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 std::vector<base::FilePath>::const_iterator it; | 1174 std::vector<base::FilePath>::const_iterator it; |
1170 for (it = profiles_to_rename.begin(); it != profiles_to_rename.end(); ++it) { | 1175 for (it = profiles_to_rename.begin(); it != profiles_to_rename.end(); ++it) { |
1171 size_t profile_index = GetIndexOfProfileWithPath(*it); | 1176 size_t profile_index = GetIndexOfProfileWithPath(*it); |
1172 SetProfileIsUsingDefaultNameAtIndex(profile_index, true); | 1177 SetProfileIsUsingDefaultNameAtIndex(profile_index, true); |
1173 // This will assign a new "Person %d" type name and re-sort the cache. | 1178 // This will assign a new "Person %d" type name and re-sort the cache. |
1174 SetNameOfProfileAtIndex(profile_index, ChooseNameForNewProfile( | 1179 SetNameOfProfileAtIndex(profile_index, ChooseNameForNewProfile( |
1175 GetAvatarIconIndexOfProfileAtIndex(profile_index))); | 1180 GetAvatarIconIndexOfProfileAtIndex(profile_index))); |
1176 } | 1181 } |
1177 #endif | 1182 #endif |
1178 } | 1183 } |
OLD | NEW |