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