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" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace chromeos { | 24 namespace chromeos { |
| 25 | 25 |
| 26 // AuthPolicyClient is used to communicate with the org.chromium.AuthPolicy | 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 | 27 // sevice. All method should be called from the origin thread (UI thread) which |
| 28 // initializes the DBusThreadManager instance. | 28 // initializes the DBusThreadManager instance. |
| 29 class CHROMEOS_EXPORT AuthPolicyClient : public DBusClient { | 29 class CHROMEOS_EXPORT AuthPolicyClient : public DBusClient { |
| 30 public: | 30 public: |
| 31 using JoinCallback = base::Callback<void(int error_code)>; | 31 using JoinCallback = base::Callback<void(int error_code)>; |
| 32 using RefreshPoliciesCallback = base::Callback<void(bool success)>; | |
| 32 | 33 |
| 33 ~AuthPolicyClient() override; | 34 ~AuthPolicyClient() override; |
| 34 | 35 |
| 35 // Factory function, creates a new instance and returns ownership. | 36 // Factory function, creates a new instance and returns ownership. |
| 36 // For normal usage, access the singleton via DBusThreadManager::Get(). | 37 // For normal usage, access the singleton via DBusThreadManager::Get(). |
| 37 static AuthPolicyClient* Create(); | 38 static AuthPolicyClient* Create(); |
| 38 | 39 |
| 39 // TODO(rsorokin): Write more descriptive comment. | 40 // Calls JoinADDomain. It runs "net ads join ..." which joins machine to |
| 40 // Calls JoinADDomain. Uses |machine_name| to join it to the domain. |user|, | 41 // Active directory domain. |
| 41 // |password_fd| are credentials of the AD user which have right to join the | 42 // |machine_name| is a name for a local machine. |user|, |
| 42 // domain. |password_fd| is a file descriptor password is read from. | 43 // |password_fd| are credentials of the Active directory account which has |
| 43 // The caller should close it after the call. | 44 // right to join the machine to the domain. |password_fd| is a file descriptor |
| 45 // password is read from. The caller should close it after the call. | |
| 44 // |callback| is called after the method call succeeds. | 46 // |callback| is called after the method call succeeds. |
| 45 virtual void JoinAdDomain(const std::string& machine_name, | 47 virtual void JoinAdDomain(const std::string& machine_name, |
| 46 const std::string& user, | 48 const std::string& user, |
| 47 int password_fd, | 49 int password_fd, |
| 48 const JoinCallback& callback) = 0; | 50 const JoinCallback& callback) = 0; |
|
hashimoto
2016/11/10 23:02:19
nit: Put blank lines between methods.
Roman Sorokin (ftl)
2016/11/14 14:10:18
Done.
| |
| 51 // Refresh{Device,User}Policies fetch GPO files with policies from Active | |
|
hashimoto
2016/11/10 23:02:19
Please write a comment for each method.
If you wan
Roman Sorokin (ftl)
2016/11/14 14:10:18
Done.
| |
| 52 // directory server, parse it, encode it into protobuf and send to | |
| 53 // SessionManager. Callback is called after that. | |
| 54 // Calls RefreshDevicePolicies - handle policies for the device. | |
| 55 virtual void RefreshDevicePolicies( | |
| 56 const RefreshPoliciesCallback& callback) = 0; | |
| 57 // Calls RefreshUserPolicies - handle policies for the user specified by | |
| 58 // |account_id|. | |
| 59 virtual void RefreshUserPolicies(const std::string& account_id, | |
| 60 const RefreshPoliciesCallback& callback) = 0; | |
| 49 | 61 |
| 50 protected: | 62 protected: |
| 51 // Create() should be used instead. | 63 // Create() should be used instead. |
| 52 AuthPolicyClient(); | 64 AuthPolicyClient(); |
| 53 | 65 |
| 54 private: | 66 private: |
| 55 DISALLOW_COPY_AND_ASSIGN(AuthPolicyClient); | 67 DISALLOW_COPY_AND_ASSIGN(AuthPolicyClient); |
| 56 }; | 68 }; |
| 57 | 69 |
| 58 } // namespace chromeos | 70 } // namespace chromeos |
| 59 | 71 |
| 60 #endif // CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ | 72 #endif // CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ |
| OLD | NEW |