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

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

Issue 2712883005: Sign out profile when local_state file has been changed. (Closed)
Patch Set: Merge from master Created 3 years, 9 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
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 <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 void ProfileInfoCache::SetProfileSigninRequiredAtIndex(size_t index, 785 void ProfileInfoCache::SetProfileSigninRequiredAtIndex(size_t index,
786 bool value) { 786 bool value) {
787 if (value == ProfileIsSigninRequiredAtIndex(index)) 787 if (value == ProfileIsSigninRequiredAtIndex(index))
788 return; 788 return;
789 789
790 std::unique_ptr<base::DictionaryValue> info( 790 std::unique_ptr<base::DictionaryValue> info(
791 GetInfoForProfileAtIndex(index)->DeepCopy()); 791 GetInfoForProfileAtIndex(index)->DeepCopy());
792 info->SetBoolean(kSigninRequiredKey, value); 792 info->SetBoolean(kSigninRequiredKey, value);
793 // This takes ownership of |info|. 793 // This takes ownership of |info|.
794 SetInfoForProfileAtIndex(index, info.release()); 794 SetInfoForProfileAtIndex(index, info.release());
795 795 NotifyIsSigninRequiredChanged(GetPathOfProfileAtIndex(index));
796 base::FilePath profile_path = GetPathOfProfileAtIndex(index);
797 for (auto& observer : observer_list_)
798 observer.OnProfileSigninRequiredChanged(profile_path);
799 } 796 }
800 797
801 void ProfileInfoCache::SetProfileIsEphemeralAtIndex(size_t index, bool value) { 798 void ProfileInfoCache::SetProfileIsEphemeralAtIndex(size_t index, bool value) {
802 if (value == ProfileIsEphemeralAtIndex(index)) 799 if (value == ProfileIsEphemeralAtIndex(index))
803 return; 800 return;
804 801
805 std::unique_ptr<base::DictionaryValue> info( 802 std::unique_ptr<base::DictionaryValue> info(
806 GetInfoForProfileAtIndex(index)->DeepCopy()); 803 GetInfoForProfileAtIndex(index)->DeepCopy());
807 info->SetBoolean(kProfileIsEphemeral, value); 804 info->SetBoolean(kProfileIsEphemeral, value);
808 // This takes ownership of |info|. 805 // This takes ownership of |info|.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 880
884 void ProfileInfoCache::SetStatsSettingsOfProfileAtIndex(size_t index, 881 void ProfileInfoCache::SetStatsSettingsOfProfileAtIndex(size_t index,
885 int value) { 882 int value) {
886 std::unique_ptr<base::DictionaryValue> info( 883 std::unique_ptr<base::DictionaryValue> info(
887 GetInfoForProfileAtIndex(index)->DeepCopy()); 884 GetInfoForProfileAtIndex(index)->DeepCopy());
888 info->SetInteger(kStatsSettingsKey, value); 885 info->SetInteger(kStatsSettingsKey, value);
889 // This takes ownership of |info|. 886 // This takes ownership of |info|.
890 SetInfoForProfileAtIndex(index, info.release()); 887 SetInfoForProfileAtIndex(index, info.release());
891 } 888 }
892 889
890 void ProfileInfoCache::NotifyIsSigninRequiredChanged(
891 const base::FilePath& profile_path) {
892 for (auto& observer : observer_list_)
893 observer.OnProfileSigninRequiredChanged(profile_path);
894 }
895
893 const base::FilePath& ProfileInfoCache::GetUserDataDir() const { 896 const base::FilePath& ProfileInfoCache::GetUserDataDir() const {
894 return user_data_dir_; 897 return user_data_dir_;
895 } 898 }
896 899
897 // static 900 // static
898 void ProfileInfoCache::RegisterPrefs(PrefRegistrySimple* registry) { 901 void ProfileInfoCache::RegisterPrefs(PrefRegistrySimple* registry) {
899 registry->RegisterDictionaryPref(prefs::kProfileInfoCache); 902 registry->RegisterDictionaryPref(prefs::kProfileInfoCache);
900 } 903 }
901 904
902 void ProfileInfoCache::DownloadHighResAvatarIfNeeded( 905 void ProfileInfoCache::DownloadHighResAvatarIfNeeded(
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 if (!current_entry) { 1230 if (!current_entry) {
1228 // The profile info is in the cache but its entry isn't created yet, insert 1231 // The profile info is in the cache but its entry isn't created yet, insert
1229 // it in the map. 1232 // it in the map.
1230 current_entry.reset(new ProfileAttributesEntry()); 1233 current_entry.reset(new ProfileAttributesEntry());
1231 current_entry->Initialize(this, path); 1234 current_entry->Initialize(this, path);
1232 } 1235 }
1233 1236
1234 *entry = current_entry.get(); 1237 *entry = current_entry.get();
1235 return true; 1238 return true;
1236 } 1239 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_info_cache.h ('k') | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698