| 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/permission_request_creator_sync.
h" | 5 #include "chrome/browser/supervised_user/legacy/permission_request_creator_sync.
h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 void PermissionRequestCreatorSync::CreateRequest( | 67 void PermissionRequestCreatorSync::CreateRequest( |
| 68 const std::string& prefix, | 68 const std::string& prefix, |
| 69 const std::string& data, | 69 const std::string& data, |
| 70 const SuccessCallback& callback) { | 70 const SuccessCallback& callback) { |
| 71 // Add the prefix. | 71 // Add the prefix. |
| 72 std::string key = | 72 std::string key = |
| 73 SupervisedUserSettingsService::MakeSplitSettingKey(prefix, data); | 73 SupervisedUserSettingsService::MakeSplitSettingKey(prefix, data); |
| 74 | 74 |
| 75 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); | 75 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue); |
| 76 // TODO(sergiu): Use sane time here when it's ready. | 76 // TODO(sergiu): Use sane time here when it's ready. |
| 77 dict->SetDouble(kSupervisedUserAccessRequestTime, | 77 dict->SetDouble(kSupervisedUserAccessRequestTime, |
| 78 base::Time::Now().ToJsTime()); | 78 base::Time::Now().ToJsTime()); |
| 79 dict->SetString(kSupervisedUserName, name_); | 79 dict->SetString(kSupervisedUserName, name_); |
| 80 | 80 |
| 81 // Copy the notification setting of the custodian. | 81 // Copy the notification setting of the custodian. |
| 82 const base::Value* value = shared_settings_service_->GetValue( | 82 const base::Value* value = shared_settings_service_->GetValue( |
| 83 supervised_user_id_, kNotificationSetting); | 83 supervised_user_id_, kNotificationSetting); |
| 84 bool notifications_enabled = false; | 84 bool notifications_enabled = false; |
| 85 if (value) { | 85 if (value) { |
| 86 bool success = value->GetAsBoolean(¬ifications_enabled); | 86 bool success = value->GetAsBoolean(¬ifications_enabled); |
| 87 DCHECK(success); | 87 DCHECK(success); |
| 88 } | 88 } |
| 89 dict->SetBoolean(kNotificationSetting, notifications_enabled); | 89 dict->SetBoolean(kNotificationSetting, notifications_enabled); |
| 90 | 90 |
| 91 settings_service_->UploadItem(key, std::move(dict)); | 91 settings_service_->UploadItem(key, std::move(dict)); |
| 92 | 92 |
| 93 callback.Run(true); | 93 callback.Run(true); |
| 94 } | 94 } |
| OLD | NEW |