Chromium Code Reviews| 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 #ifndef CHROMEOS_DBUS_FAKE_AUTH_POLICY_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_AUTH_POLICY_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_FAKE_AUTH_POLICY_CLIENT_H_ | 6 #define CHROMEOS_DBUS_FAKE_AUTH_POLICY_CLIENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" | |
| 11 | 12 |
| 12 #include "chromeos/dbus/auth_policy_client.h" | 13 #include "chromeos/dbus/auth_policy_client.h" |
| 13 | 14 |
| 14 namespace chromeos { | 15 namespace chromeos { |
| 15 | 16 |
| 16 class CHROMEOS_EXPORT FakeAuthPolicyClient : public AuthPolicyClient { | 17 class CHROMEOS_EXPORT FakeAuthPolicyClient : public AuthPolicyClient { |
| 17 public: | 18 public: |
| 18 FakeAuthPolicyClient(); | 19 FakeAuthPolicyClient(); |
| 19 ~FakeAuthPolicyClient() override; | 20 ~FakeAuthPolicyClient() override; |
| 20 | 21 |
| 21 // DBusClient overrides. | 22 // DBusClient overrides. |
| 22 void Init(dbus::Bus* bus) override; | 23 void Init(dbus::Bus* bus) override; |
| 23 // AuthPolicyClient overrides. | 24 // AuthPolicyClient overrides. |
| 24 void JoinAdDomain(const std::string& machine_name, | 25 void JoinAdDomain(const std::string& machine_name, |
| 25 const std::string& user, | 26 const std::string& user, |
| 26 int password_fd, | 27 int password_fd, |
| 27 const JoinCallback& callback) override; | 28 const JoinCallback& callback) override; |
| 28 void RefreshDevicePolicy(const RefreshPolicyCallback& calllback) override; | 29 void RefreshDevicePolicy(const RefreshPolicyCallback& callback) override; |
| 29 void RefreshUserPolicy(const std::string& account_id, | 30 void RefreshUserPolicy(const std::string& account_id, |
| 30 const RefreshPolicyCallback& calllback) override; | 31 const RefreshPolicyCallback& callback) override; |
| 31 | 32 |
| 32 private: | 33 private: |
| 34 static int WriteDevicePolicyFile(); | |
|
achuithb
2016/11/30 19:23:34
We prefer functions in the anonymous namespace in
Thiemo Nagel
2016/11/30 20:06:36
Done.
| |
| 35 void OnDevicePolicyFileWritten(const RefreshPolicyCallback& callback, | |
| 36 int bytes_written); | |
|
achuithb
2016/11/30 19:23:34
Let's add a function comment.
Thiemo Nagel
2016/11/30 20:06:36
Done.
| |
| 37 | |
| 38 base::WeakPtrFactory<FakeAuthPolicyClient> weak_factory_{this}; | |
|
achuithb
2016/11/30 19:23:34
Is this allowed by the c++11 guidelines? Have you
Thiemo Nagel
2016/11/30 20:06:36
We allow Uniform Initialization Syntax and Non-Sta
achuithb
2016/11/30 20:22:49
Personally, I really like this, and would love to
| |
| 39 | |
| 33 DISALLOW_COPY_AND_ASSIGN(FakeAuthPolicyClient); | 40 DISALLOW_COPY_AND_ASSIGN(FakeAuthPolicyClient); |
| 34 }; | 41 }; |
| 35 | 42 |
| 36 } // namespace chromeos | 43 } // namespace chromeos |
| 37 | 44 |
| 38 #endif // CHROMEOS_DBUS_FAKE_AUTH_POLICY_CLIENT_H_ | 45 #endif // CHROMEOS_DBUS_FAKE_AUTH_POLICY_CLIENT_H_ |
| OLD | NEW |