OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/supervised_user/legacy/supervised_user_pref_mapping_ser
vice.h" | 5 #include "chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_ser
vice.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_
service.h" | 9 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_
service.h" |
10 #include "chrome/browser/supervised_user/supervised_user_constants.h" | 10 #include "chrome/browser/supervised_user/supervised_user_constants.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 if (new_avatar_index < 0) | 49 if (new_avatar_index < 0) |
50 return; | 50 return; |
51 | 51 |
52 // First check if the avatar index is a new value. | 52 // First check if the avatar index is a new value. |
53 if (GetChromeAvatarIndex() == new_avatar_index) | 53 if (GetChromeAvatarIndex() == new_avatar_index) |
54 return; | 54 return; |
55 | 55 |
56 // If yes, update the shared settings value. | 56 // If yes, update the shared settings value. |
57 shared_settings_->SetValue(supervised_user_id_, | 57 shared_settings_->SetValue(supervised_user_id_, |
58 supervised_users::kChromeAvatarIndex, | 58 supervised_users::kChromeAvatarIndex, |
59 base::FundamentalValue(new_avatar_index)); | 59 base::Value(new_avatar_index)); |
60 } | 60 } |
61 | 61 |
62 void SupervisedUserPrefMappingService::OnSharedSettingChanged( | 62 void SupervisedUserPrefMappingService::OnSharedSettingChanged( |
63 const std::string& su_id, | 63 const std::string& su_id, |
64 const std::string& key) { | 64 const std::string& key) { |
65 DCHECK_EQ(su_id, supervised_user_id_); | 65 DCHECK_EQ(su_id, supervised_user_id_); |
66 if (key != supervised_users::kChromeAvatarIndex) | 66 if (key != supervised_users::kChromeAvatarIndex) |
67 return; | 67 return; |
68 | 68 |
69 const base::Value* value = shared_settings_->GetValue(su_id, key); | 69 const base::Value* value = shared_settings_->GetValue(su_id, key); |
(...skipping 11 matching lines...) Expand all Loading... |
81 const base::Value* value = shared_settings_->GetValue( | 81 const base::Value* value = shared_settings_->GetValue( |
82 supervised_user_id_, supervised_users::kChromeAvatarIndex); | 82 supervised_user_id_, supervised_users::kChromeAvatarIndex); |
83 if (!value) | 83 if (!value) |
84 return kNoAvatar; | 84 return kNoAvatar; |
85 | 85 |
86 int current_avatar_index; | 86 int current_avatar_index; |
87 bool success = value->GetAsInteger(¤t_avatar_index); | 87 bool success = value->GetAsInteger(¤t_avatar_index); |
88 DCHECK(success); | 88 DCHECK(success); |
89 return current_avatar_index; | 89 return current_avatar_index; |
90 } | 90 } |
OLD | NEW |