| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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" |
| 11 #include "base/md5.h" |
| 11 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 12 #include "base/task_runner_util.h" | 13 #include "base/task_runner_util.h" |
| 13 #include "base/threading/worker_pool.h" | 14 #include "base/threading/worker_pool.h" |
| 14 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 15 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
| 15 #include "chromeos/chromeos_paths.h" | 16 #include "chromeos/chromeos_paths.h" |
| 16 #include "components/policy/proto/device_management_backend.pb.h" | 17 #include "components/policy/proto/device_management_backend.pb.h" |
| 17 | 18 |
| 18 namespace em = enterprise_management; | 19 namespace em = enterprise_management; |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 55 |
| 55 namespace chromeos { | 56 namespace chromeos { |
| 56 | 57 |
| 57 FakeAuthPolicyClient::FakeAuthPolicyClient() {} | 58 FakeAuthPolicyClient::FakeAuthPolicyClient() {} |
| 58 | 59 |
| 59 FakeAuthPolicyClient::~FakeAuthPolicyClient() {} | 60 FakeAuthPolicyClient::~FakeAuthPolicyClient() {} |
| 60 | 61 |
| 61 void FakeAuthPolicyClient::Init(dbus::Bus* bus) {} | 62 void FakeAuthPolicyClient::Init(dbus::Bus* bus) {} |
| 62 | 63 |
| 63 void FakeAuthPolicyClient::JoinAdDomain(const std::string& machine_name, | 64 void FakeAuthPolicyClient::JoinAdDomain(const std::string& machine_name, |
| 64 const std::string& user, | 65 const std::string& user_principal_name, |
| 65 int password_fd, | 66 int password_fd, |
| 66 const JoinCallback& callback) { | 67 const JoinCallback& callback) { |
| 67 callback.Run(authpolicy::types::AD_JOIN_ERROR_NONE); | 68 callback.Run(authpolicy::types::AD_JOIN_ERROR_NONE); |
| 68 } | 69 } |
| 69 | 70 |
| 71 void FakeAuthPolicyClient::AuthenticateUser( |
| 72 const std::string& user_principal_name, |
| 73 int password_fd, |
| 74 const AuthCallback& callback) { |
| 75 callback.Run(authpolicy::AUTH_USER_ERROR_NONE, |
| 76 base::MD5String(user_principal_name)); |
| 77 } |
| 78 |
| 70 void FakeAuthPolicyClient::RefreshDevicePolicy( | 79 void FakeAuthPolicyClient::RefreshDevicePolicy( |
| 71 const RefreshPolicyCallback& callback) { | 80 const RefreshPolicyCallback& callback) { |
| 72 if (!base::PostTaskAndReplyWithResult( | 81 if (!base::PostTaskAndReplyWithResult( |
| 73 base::WorkerPool::GetTaskRunner(false /* task_is_slow */).get(), | 82 base::WorkerPool::GetTaskRunner(false /* task_is_slow */).get(), |
| 74 FROM_HERE, base::Bind(&WriteDevicePolicyFile), callback)) { | 83 FROM_HERE, base::Bind(&WriteDevicePolicyFile), callback)) { |
| 75 callback.Run(false); | 84 callback.Run(false); |
| 76 } | 85 } |
| 77 } | 86 } |
| 78 | 87 |
| 79 void FakeAuthPolicyClient::RefreshUserPolicy( | 88 void FakeAuthPolicyClient::RefreshUserPolicy( |
| 80 const std::string& account_id, | 89 const std::string& account_id, |
| 81 const RefreshPolicyCallback& callback) { | 90 const RefreshPolicyCallback& callback) { |
| 82 callback.Run(true); | 91 callback.Run(true); |
| 83 } | 92 } |
| 84 | 93 |
| 85 } // namespace chromeos | 94 } // namespace chromeos |
| OLD | NEW |