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_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 | 13 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 14 // TODO(rsorokin): Switch to service constants when it's landed. | |
| 15 // (see crbug.com/659732) | |
| 16 namespace authpolicy { | |
| 17 namespace types { | |
| 18 enum ADJoinErrorType { | |
| 19 AD_JOIN_ERROR_NONE = 0, | |
| 20 AD_JOIN_ERROR_UNKNOWN = 1, | |
| 21 AD_JOIN_ERROR_DBUS_FAIL = 2, | |
| 22 }; | |
| 23 } // namespace types | |
| 24 } // namespace authpolicy | |
| 25 | 14 |
| 26 namespace chromeos { | 15 namespace chromeos { |
| 27 | 16 |
| 28 // AuthPolicyClient is used to communicate with the org.chromium.AuthPolicy | 17 // AuthPolicyClient is used to communicate with the org.chromium.AuthPolicy |
| 29 // 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 |
| 30 // initializes the DBusThreadManager instance. | 19 // initializes the DBusThreadManager instance. |
| 31 class CHROMEOS_EXPORT AuthPolicyClient : public DBusClient { | 20 class CHROMEOS_EXPORT AuthPolicyClient : public DBusClient { |
| 32 public: | 21 public: |
|
Alexander Alekseev
2016/12/21 14:45:30
nit: please document here that error-code may be o
| |
| 33 using JoinCallback = base::Callback<void(int error_code)>; | 22 using JoinCallback = |
| 23 base::Callback<void(authpolicy::ADJoinErrorType error_code)>; | |
| 34 using RefreshPolicyCallback = base::Callback<void(bool success)>; | 24 using RefreshPolicyCallback = base::Callback<void(bool success)>; |
| 35 | 25 |
| 36 ~AuthPolicyClient() override; | 26 ~AuthPolicyClient() override; |
| 37 | 27 |
| 38 // Factory function, creates a new instance and returns ownership. | 28 // Factory function, creates a new instance and returns ownership. |
| 39 // For normal usage, access the singleton via DBusThreadManager::Get(). | 29 // For normal usage, access the singleton via DBusThreadManager::Get(). |
| 40 static AuthPolicyClient* Create(); | 30 static AuthPolicyClient* Create(); |
| 41 | 31 |
| 42 // Calls JoinADDomain. It runs "net ads join ..." which joins machine to | 32 // Calls JoinADDomain. It runs "net ads join ..." which joins machine to |
| 43 // Active directory domain. | 33 // Active directory domain. |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 65 // Create() should be used instead. | 55 // Create() should be used instead. |
| 66 AuthPolicyClient(); | 56 AuthPolicyClient(); |
| 67 | 57 |
| 68 private: | 58 private: |
| 69 DISALLOW_COPY_AND_ASSIGN(AuthPolicyClient); | 59 DISALLOW_COPY_AND_ASSIGN(AuthPolicyClient); |
| 70 }; | 60 }; |
| 71 | 61 |
| 72 } // namespace chromeos | 62 } // namespace chromeos |
| 73 | 63 |
| 74 #endif // CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ | 64 #endif // CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ |
| OLD | NEW |