| Index: chromeos/dbus/auth_policy_client.h
|
| diff --git a/chromeos/dbus/auth_policy_client.h b/chromeos/dbus/auth_policy_client.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0ff4d6d44cf14c31dd76eed2ebd261549342249c
|
| --- /dev/null
|
| +++ b/chromeos/dbus/auth_policy_client.h
|
| @@ -0,0 +1,59 @@
|
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_
|
| +#define CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/callback.h"
|
| +#include "chromeos/chromeos_export.h"
|
| +#include "chromeos/dbus/dbus_client.h"
|
| +
|
| +// TODO(rsorokin, 659732): Switch to service constants when it's landed.
|
| +namespace authpolicy {
|
| +enum ADJoinErrorType {
|
| + AD_JOIN_ERROR_NONE = 0,
|
| + AD_JOIN_ERROR_UNKNOWN = 1,
|
| + AD_JOIN_ERROR_DBUS_FAIL = 2,
|
| +};
|
| +}
|
| +
|
| +namespace chromeos {
|
| +
|
| +// AuthPolicyClient is used to communicate with the org.chromium.AuthPolicy
|
| +// sevice. All method should be called from the origin thread (UI thread) which
|
| +// initializes the DBusThreadManager instance.
|
| +class CHROMEOS_EXPORT AuthPolicyClient : public DBusClient {
|
| + public:
|
| + using JoinCallback = base::Callback<void(int error_code)>;
|
| +
|
| + ~AuthPolicyClient() override;
|
| +
|
| + // Factory function, creates a new instance and returns ownership.
|
| + // For normal usage, access the singleton via DBusThreadManager::Get().
|
| + static AuthPolicyClient* Create();
|
| +
|
| + // TODO(rsorokin): Write more descriptive comment.
|
| + // Calls JoinADDomain. Uses |machine_name| to join it to the domain. |user|,
|
| + // |password_fd| are credentials of the AD user which have right to join the
|
| + // domain. |password_fd| is a file descriptor password is read from.
|
| + // The caller should close it after the call.
|
| + // |callback| is called after the method call succeeds.
|
| + virtual void JoinADDomain(const std::string& machine_name,
|
| + const std::string& user,
|
| + int password_fd,
|
| + const JoinCallback& callback) = 0;
|
| +
|
| + protected:
|
| + // Create() should be used instead.
|
| + AuthPolicyClient();
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(AuthPolicyClient);
|
| +};
|
| +
|
| +} // namespace chromeos
|
| +
|
| +#endif // CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_
|
|
|