Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ | |
| 6 #define CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "chromeos/chromeos_export.h" | |
| 12 #include "chromeos/dbus/dbus_client.h" | |
| 13 | |
| 14 // TODO(rsorokin): Switch to service constants when it's landed. | |
| 15 // (see crbug.com/659732) | |
| 16 namespace authpolicy { | |
| 17 enum ADJoinErrorType { | |
| 18 AD_JOIN_ERROR_NONE = 0, | |
| 19 AD_JOIN_ERROR_UNKNOWN = 1, | |
| 20 AD_JOIN_ERROR_DBUS_FAIL = 2, | |
| 21 }; | |
| 22 } | |
| 23 | |
| 24 namespace chromeos { | |
| 25 | |
| 26 // AuthPolicyClient is used to communicate with the org.chromium.AuthPolicy | |
| 27 // sevice. All method should be called from the origin thread (UI thread) which | |
| 28 // initializes the DBusThreadManager instance. | |
| 29 class CHROMEOS_EXPORT AuthPolicyClient : public DBusClient { | |
| 30 public: | |
| 31 using JoinCallback = base::Callback<void(int error_code)>; | |
| 32 | |
| 33 ~AuthPolicyClient() override; | |
| 34 | |
| 35 // Factory function, creates a new instance and returns ownership. | |
| 36 // For normal usage, access the singleton via DBusThreadManager::Get(). | |
| 37 static AuthPolicyClient* Create(); | |
| 38 | |
| 39 // TODO(rsorokin): Write more descriptive comment. | |
| 40 // Calls JoinADDomain. Uses |machine_name| to join it to the domain. |user|, | |
| 41 // |password_fd| are credentials of the AD user which have right to join the | |
| 42 // domain. |password_fd| is a file descriptor password is read from. | |
| 43 // The caller should close it after the call. | |
| 44 // |callback| is called after the method call succeeds. | |
| 45 virtual void JoinADDomain(const std::string& machine_name, | |
|
Dan Beam
2016/10/28 21:13:04
JoinAdDomain
Roman Sorokin (ftl)
2016/10/31 11:37:11
Done.
| |
| 46 const std::string& user, | |
| 47 int password_fd, | |
| 48 const JoinCallback& callback) = 0; | |
| 49 | |
| 50 protected: | |
| 51 // Create() should be used instead. | |
| 52 AuthPolicyClient(); | |
| 53 | |
| 54 private: | |
| 55 DISALLOW_COPY_AND_ASSIGN(AuthPolicyClient); | |
| 56 }; | |
| 57 | |
| 58 } // namespace chromeos | |
| 59 | |
| 60 #endif // CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ | |
| OLD | NEW |