Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Unified Diff: chromeos/dbus/auth_policy_client.cc

Issue 2475343002: Add UpstartClient (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/dbus/auth_policy_client.h ('k') | chromeos/dbus/fake_auth_policy_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/auth_policy_client.cc
diff --git a/chromeos/dbus/auth_policy_client.cc b/chromeos/dbus/auth_policy_client.cc
index 7c86b81702a56891f8eebca4a9f3eaaee946d206..88d2136d4ce66d3a5306636578d7981303f77d32 100644
--- a/chromeos/dbus/auth_policy_client.cc
+++ b/chromeos/dbus/auth_policy_client.cc
@@ -14,6 +14,11 @@ namespace chromeos {
namespace {
+const char kUpstartServiceName[] = "com.ubuntu.Upstart";
hashimoto 2016/11/08 00:12:26 AuthPolicyClient should deal only with AuthPolicy
Roman Sorokin (ftl) 2016/11/08 10:43:13 Done.
+const char kUpstartObjectPath[] = "/com/ubuntu/Upstart/jobs/authpolicyd";
+const char kUpstartJobInterface[] = "com.ubuntu.Upstart0_6.Job";
+const char kUpstartStartMethod[] = "Start";
+
class AuthPolicyClientImpl : public AuthPolicyClient {
public:
AuthPolicyClientImpl() : weak_ptr_factory_(this) {}
@@ -21,6 +26,20 @@ class AuthPolicyClientImpl : public AuthPolicyClient {
~AuthPolicyClientImpl() override {}
// AuthPolicyClient override.
+ void StartService() override {
+ dbus::ObjectPath objectPath(kUpstartObjectPath);
+ dbus::ObjectProxy* proxy =
+ bus_->GetObjectProxy(kUpstartServiceName, objectPath);
+ dbus::MethodCall method_call(kUpstartJobInterface, kUpstartStartMethod);
+ dbus::MessageWriter writer(&method_call);
+ dbus::MessageWriter sub_writer(nullptr);
+ writer.OpenArray("s", &sub_writer);
+ writer.CloseContainer(&sub_writer);
+ writer.AppendBool(false); // No waiting for response.
+ proxy->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ base::Bind(&AuthPolicyClientImpl::HandleUpstartCallback,
+ weak_ptr_factory_.GetWeakPtr()));
+ }
void JoinAdDomain(const std::string& machine_name,
const std::string& user,
int password_fd,
@@ -43,6 +62,12 @@ class AuthPolicyClientImpl : public AuthPolicyClient {
void Init(dbus::Bus* bus) override { bus_ = bus; }
private:
+ void HandleUpstartCallback(dbus::Response* response) {
+ if (!response) {
+ LOG(ERROR) << "Failed to start authpolicyd, response is null";
+ return;
+ }
+ }
void HandleJoinCallback(const JoinCallback& callback,
dbus::Response* response) {
if (!response) {
« no previous file with comments | « chromeos/dbus/auth_policy_client.h ('k') | chromeos/dbus/fake_auth_policy_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698