| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chromeos/dbus/fake_auth_policy_client.h" | 5 #include "chromeos/dbus/fake_auth_policy_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 } | 146 } |
| 147 policy_path = policy_path.DirName().AppendASCII("stub_device_policy"); | 147 policy_path = policy_path.DirName().AppendASCII("stub_device_policy"); |
| 148 | 148 |
| 149 em::ChromeDeviceSettingsProto policy; | 149 em::ChromeDeviceSettingsProto policy; |
| 150 std::string payload; | 150 std::string payload; |
| 151 CHECK(policy.SerializeToString(&payload)); | 151 CHECK(policy.SerializeToString(&payload)); |
| 152 | 152 |
| 153 // Drop file for SessionManagerClientStubImpl to read. | 153 // Drop file for SessionManagerClientStubImpl to read. |
| 154 base::PostTaskWithTraitsAndReplyWithResult( | 154 base::PostTaskWithTraitsAndReplyWithResult( |
| 155 FROM_HERE, | 155 FROM_HERE, |
| 156 base::TaskTraits() | 156 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
| 157 .WithShutdownBehavior( | 157 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, |
| 158 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) | |
| 159 .WithPriority(base::TaskPriority::BACKGROUND) | |
| 160 .MayBlock(), | |
| 161 base::BindOnce(&WritePolicyFile, policy_path, payload, | 158 base::BindOnce(&WritePolicyFile, policy_path, payload, |
| 162 "google/chromeos/device"), | 159 "google/chromeos/device"), |
| 163 std::move(callback)); | 160 std::move(callback)); |
| 164 } | 161 } |
| 165 | 162 |
| 166 void FakeAuthPolicyClient::RefreshUserPolicy(const AccountId& account_id, | 163 void FakeAuthPolicyClient::RefreshUserPolicy(const AccountId& account_id, |
| 167 RefreshPolicyCallback callback) { | 164 RefreshPolicyCallback callback) { |
| 168 if (!started_) { | 165 if (!started_) { |
| 169 LOG(ERROR) << "authpolicyd not started"; | 166 LOG(ERROR) << "authpolicyd not started"; |
| 170 std::move(callback).Run(false); | 167 std::move(callback).Run(false); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 182 policy_path = policy_path.AppendASCII(sanitized_username); | 179 policy_path = policy_path.AppendASCII(sanitized_username); |
| 183 policy_path = policy_path.AppendASCII("stub_policy"); | 180 policy_path = policy_path.AppendASCII("stub_policy"); |
| 184 | 181 |
| 185 em::CloudPolicySettings policy; | 182 em::CloudPolicySettings policy; |
| 186 std::string payload; | 183 std::string payload; |
| 187 CHECK(policy.SerializeToString(&payload)); | 184 CHECK(policy.SerializeToString(&payload)); |
| 188 | 185 |
| 189 // Drop file for SessionManagerClientStubImpl to read. | 186 // Drop file for SessionManagerClientStubImpl to read. |
| 190 base::PostTaskWithTraitsAndReplyWithResult( | 187 base::PostTaskWithTraitsAndReplyWithResult( |
| 191 FROM_HERE, | 188 FROM_HERE, |
| 192 base::TaskTraits() | 189 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
| 193 .WithShutdownBehavior( | 190 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, |
| 194 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) | |
| 195 .WithPriority(base::TaskPriority::BACKGROUND) | |
| 196 .MayBlock(), | |
| 197 base::BindOnce(&WritePolicyFile, policy_path, payload, | 191 base::BindOnce(&WritePolicyFile, policy_path, payload, |
| 198 "google/chromeos/user"), | 192 "google/chromeos/user"), |
| 199 std::move(callback)); | 193 std::move(callback)); |
| 200 } | 194 } |
| 201 | 195 |
| 202 } // namespace chromeos | 196 } // namespace chromeos |
| OLD | NEW |