| Index: chrome/browser/supervised_user/supervised_user_pref_mapping_service.cc
|
| diff --git a/chrome/browser/managed_mode/supervised_user_pref_mapping_service.cc b/chrome/browser/supervised_user/supervised_user_pref_mapping_service.cc
|
| similarity index 71%
|
| rename from chrome/browser/managed_mode/supervised_user_pref_mapping_service.cc
|
| rename to chrome/browser/supervised_user/supervised_user_pref_mapping_service.cc
|
| index dce816560bcc41ff4e45c339cd82511f9528f920..b70ae6334920ecb4b3040889ab0d3c204459eb17 100644
|
| --- a/chrome/browser/managed_mode/supervised_user_pref_mapping_service.cc
|
| +++ b/chrome/browser/supervised_user/supervised_user_pref_mapping_service.cc
|
| @@ -2,23 +2,23 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/browser/managed_mode/supervised_user_pref_mapping_service.h"
|
| +#include "chrome/browser/supervised_user/supervised_user_pref_mapping_service.h"
|
|
|
| #include "base/bind.h"
|
| #include "base/prefs/pref_service.h"
|
| #include "base/values.h"
|
| -#include "chrome/browser/managed_mode/managed_user_constants.h"
|
| -#include "chrome/browser/managed_mode/managed_user_shared_settings_service.h"
|
| +#include "chrome/browser/supervised_user/supervised_user_constants.h"
|
| +#include "chrome/browser/supervised_user/supervised_user_shared_settings_service.h"
|
| #include "chrome/common/pref_names.h"
|
|
|
| const int kNoAvatar = -1;
|
|
|
| SupervisedUserPrefMappingService::SupervisedUserPrefMappingService(
|
| PrefService* prefs,
|
| - ManagedUserSharedSettingsService* shared_settings)
|
| + SupervisedUserSharedSettingsService* shared_settings)
|
| : prefs_(prefs),
|
| shared_settings_(shared_settings),
|
| - managed_user_id_(prefs->GetString(prefs::kSupervisedUserId)),
|
| + supervised_user_id_(prefs->GetString(prefs::kSupervisedUserId)),
|
| weak_ptr_factory_(this) {}
|
|
|
| SupervisedUserPrefMappingService::~SupervisedUserPrefMappingService() {}
|
| @@ -36,10 +36,12 @@ void SupervisedUserPrefMappingService::Init() {
|
|
|
| // Check if we need to update the shared setting with the avatar index.
|
| // Otherwise we update the user pref in case we missed a notification.
|
| - if (GetChromeAvatarIndex() == kNoAvatar)
|
| + if (GetChromeAvatarIndex() == kNoAvatar) {
|
| OnAvatarChanged();
|
| - else
|
| - OnSharedSettingChanged(managed_user_id_, managed_users::kChromeAvatarIndex);
|
| + } else {
|
| + OnSharedSettingChanged(supervised_user_id_,
|
| + supervised_users::kChromeAvatarIndex);
|
| + }
|
| }
|
|
|
| void SupervisedUserPrefMappingService::OnAvatarChanged() {
|
| @@ -52,19 +54,19 @@ void SupervisedUserPrefMappingService::OnAvatarChanged() {
|
| return;
|
|
|
| // If yes, update the shared settings value.
|
| - shared_settings_->SetValue(managed_user_id_,
|
| - managed_users::kChromeAvatarIndex,
|
| + shared_settings_->SetValue(supervised_user_id_,
|
| + supervised_users::kChromeAvatarIndex,
|
| base::FundamentalValue(new_avatar_index));
|
| }
|
|
|
| void SupervisedUserPrefMappingService::OnSharedSettingChanged(
|
| - const std::string& mu_id,
|
| + const std::string& su_id,
|
| const std::string& key) {
|
| - DCHECK_EQ(mu_id, managed_user_id_);
|
| - if (key != managed_users::kChromeAvatarIndex)
|
| + DCHECK_EQ(su_id, supervised_user_id_);
|
| + if (key != supervised_users::kChromeAvatarIndex)
|
| return;
|
|
|
| - const base::Value* value = shared_settings_->GetValue(mu_id, key);
|
| + const base::Value* value = shared_settings_->GetValue(su_id, key);
|
| int avatar_index;
|
| bool success = value->GetAsInteger(&avatar_index);
|
| DCHECK(success);
|
| @@ -77,7 +79,7 @@ void SupervisedUserPrefMappingService::Shutdown() {
|
|
|
| int SupervisedUserPrefMappingService::GetChromeAvatarIndex() {
|
| const base::Value* value = shared_settings_->GetValue(
|
| - managed_user_id_, managed_users::kChromeAvatarIndex);
|
| + supervised_user_id_, supervised_users::kChromeAvatarIndex);
|
| if (!value)
|
| return kNoAvatar;
|
|
|
|
|