| 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_AUTH_POLICY_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ | 6 #define CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "chromeos/chromeos_export.h" | 11 #include "chromeos/chromeos_export.h" |
| 12 #include "chromeos/dbus/dbus_client.h" | 12 #include "chromeos/dbus/dbus_client.h" |
| 13 #include "third_party/cros_system_api/dbus/service_constants.h" | 13 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 14 | 14 |
| 15 // TODO(rsorokin): Switch to service constants when it's landed. | |
| 16 // (see crbug.com/659732) | |
| 17 namespace authpolicy { | |
| 18 namespace types { | |
| 19 enum ADJoinErrorType { | |
| 20 AD_JOIN_ERROR_NONE = 0, | |
| 21 AD_JOIN_ERROR_UNKNOWN = 1, | |
| 22 AD_JOIN_ERROR_DBUS_FAIL = 2, | |
| 23 }; | |
| 24 } // namespace types | |
| 25 } // namespace authpolicy | |
| 26 | |
| 27 namespace chromeos { | 15 namespace chromeos { |
| 28 | 16 |
| 29 // AuthPolicyClient is used to communicate with the org.chromium.AuthPolicy | 17 // AuthPolicyClient is used to communicate with the org.chromium.AuthPolicy |
| 30 // sevice. All method should be called from the origin thread (UI thread) which | 18 // sevice. All method should be called from the origin thread (UI thread) which |
| 31 // initializes the DBusThreadManager instance. | 19 // initializes the DBusThreadManager instance. |
| 32 class CHROMEOS_EXPORT AuthPolicyClient : public DBusClient { | 20 class CHROMEOS_EXPORT AuthPolicyClient : public DBusClient { |
| 33 public: | 21 public: |
| 34 // |user_id| is a unique id for the users. Using objectGUID from Active | 22 // |user_id| is a unique id for the users. Using objectGUID from Active |
| 35 // Directory server. | 23 // Directory server. |
| 36 using AuthCallback = base::Callback<void(authpolicy::AuthUserErrorType error, | 24 using AuthCallback = base::Callback<void(authpolicy::ErrorType error, |
| 37 const std::string& user_id)>; | 25 const std::string& user_id)>; |
| 38 using JoinCallback = base::Callback<void(int error_code)>; | 26 using JoinCallback = base::Callback<void(authpolicy::ErrorType error)>; |
| 39 using RefreshPolicyCallback = base::Callback<void(bool success)>; | 27 using RefreshPolicyCallback = base::Callback<void(bool success)>; |
| 40 | 28 |
| 41 ~AuthPolicyClient() override; | 29 ~AuthPolicyClient() override; |
| 42 | 30 |
| 43 // Factory function, creates a new instance and returns ownership. | 31 // Factory function, creates a new instance and returns ownership. |
| 44 // For normal usage, access the singleton via DBusThreadManager::Get(). | 32 // For normal usage, access the singleton via DBusThreadManager::Get(). |
| 45 static AuthPolicyClient* Create(); | 33 static AuthPolicyClient* Create(); |
| 46 | 34 |
| 47 // Calls JoinADDomain. It runs "net ads join ..." which joins machine to | 35 // Calls JoinADDomain. It runs "net ads join ..." which joins machine to |
| 48 // Active directory domain. | 36 // Active directory domain. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 78 // Create() should be used instead. | 66 // Create() should be used instead. |
| 79 AuthPolicyClient(); | 67 AuthPolicyClient(); |
| 80 | 68 |
| 81 private: | 69 private: |
| 82 DISALLOW_COPY_AND_ASSIGN(AuthPolicyClient); | 70 DISALLOW_COPY_AND_ASSIGN(AuthPolicyClient); |
| 83 }; | 71 }; |
| 84 | 72 |
| 85 } // namespace chromeos | 73 } // namespace chromeos |
| 86 | 74 |
| 87 #endif // CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ | 75 #endif // CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ |
| OLD | NEW |