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/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/task_runner_util.h" | 12 #include "base/task_runner_util.h" |
13 #include "base/threading/worker_pool.h" | 13 #include "base/threading/worker_pool.h" |
14 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 14 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
15 #include "chromeos/chromeos_paths.h" | 15 #include "chromeos/chromeos_paths.h" |
16 #include "components/policy/proto/device_management_backend.pb.h" | 16 #include "components/policy/proto/device_management_backend.pb.h" |
| 17 #include "third_party/cros_system_api/dbus/service_constants.h" |
17 | 18 |
18 namespace em = enterprise_management; | 19 namespace em = enterprise_management; |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 // Create minimal stub device policy file and drop it at the place where | 23 // Create minimal stub device policy file and drop it at the place where |
23 // SessionManagerClientStubImpl is looking for it. | 24 // SessionManagerClientStubImpl is looking for it. |
24 bool WriteDevicePolicyFile() { | 25 bool WriteDevicePolicyFile() { |
25 em::ChromeDeviceSettingsProto policy; | 26 em::ChromeDeviceSettingsProto policy; |
26 em::PolicyData data; | 27 em::PolicyData data; |
(...skipping 30 matching lines...) Expand all Loading... |
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, |
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::AD_JOIN_ERROR_NONE); |
68 } | 69 } |
69 | 70 |
70 void FakeAuthPolicyClient::RefreshDevicePolicy( | 71 void FakeAuthPolicyClient::RefreshDevicePolicy( |
71 const RefreshPolicyCallback& callback) { | 72 const RefreshPolicyCallback& callback) { |
72 if (!base::PostTaskAndReplyWithResult( | 73 if (!base::PostTaskAndReplyWithResult( |
73 base::WorkerPool::GetTaskRunner(false /* task_is_slow */).get(), | 74 base::WorkerPool::GetTaskRunner(false /* task_is_slow */).get(), |
74 FROM_HERE, base::Bind(&WriteDevicePolicyFile), callback)) { | 75 FROM_HERE, base::Bind(&WriteDevicePolicyFile), callback)) { |
75 callback.Run(false); | 76 callback.Run(false); |
76 } | 77 } |
77 } | 78 } |
78 | 79 |
79 void FakeAuthPolicyClient::RefreshUserPolicy( | 80 void FakeAuthPolicyClient::RefreshUserPolicy( |
80 const std::string& account_id, | 81 const std::string& account_id, |
81 const RefreshPolicyCallback& callback) { | 82 const RefreshPolicyCallback& callback) { |
82 callback.Run(true); | 83 callback.Run(true); |
83 } | 84 } |
84 | 85 |
85 } // namespace chromeos | 86 } // namespace chromeos |
OLD | NEW |