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

Unified Diff: chromeos/dbus/upstart_client.cc

Issue 2794493002: Add AuthPolicyLoginHelper (Closed)
Patch Set: Update after review Created 3 years, 8 months 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/upstart_client.h ('k') | chromeos/login/auth/authpolicy_login_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/upstart_client.cc
diff --git a/chromeos/dbus/upstart_client.cc b/chromeos/dbus/upstart_client.cc
index 7e08d265c8bab4695f075fdc91f2f8e0a82d5250..2f4d61555fff317b016b02bfa5ac9c734720dc86 100644
--- a/chromeos/dbus/upstart_client.cc
+++ b/chromeos/dbus/upstart_client.cc
@@ -17,6 +17,7 @@ namespace {
const char kUpstartServiceName[] = "com.ubuntu.Upstart";
const char kUpstartJobInterface[] = "com.ubuntu.Upstart0_6.Job";
const char kUpstartStartMethod[] = "Start";
+const char kUpstartRestartMethod[] = "Restart";
const char kUpstartAuthPolicyPath[] = "/com/ubuntu/Upstart/jobs/authpolicyd";
@@ -28,27 +29,41 @@ class UpstartClientImpl : public UpstartClient {
// UpstartClient override.
void StartAuthPolicyService() override {
- dbus::ObjectPath objectPath(kUpstartAuthPolicyPath);
- dbus::ObjectProxy* proxy =
- bus_->GetObjectProxy(kUpstartServiceName, objectPath);
dbus::MethodCall method_call(kUpstartJobInterface, kUpstartStartMethod);
dbus::MessageWriter writer(&method_call);
writer.AppendArrayOfStrings(std::vector<std::string>());
writer.AppendBool(true); // Wait for response.
- proxy->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
- base::Bind(&UpstartClientImpl::HandleStartResponse,
- weak_ptr_factory_.GetWeakPtr()));
+ auth_proxy_->CallMethod(&method_call,
+ dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ base::Bind(&UpstartClientImpl::HandleAuthResponse,
+ weak_ptr_factory_.GetWeakPtr()));
+ }
+
+ void RestartAuthPolicyService() override {
+ dbus::MethodCall method_call(kUpstartJobInterface, kUpstartRestartMethod);
+ dbus::MessageWriter writer(&method_call);
+ writer.AppendArrayOfStrings(std::vector<std::string>());
+ writer.AppendBool(true); // Wait for response.
+ auth_proxy_->CallMethod(&method_call,
+ dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ base::Bind(&UpstartClientImpl::HandleAuthResponse,
+ weak_ptr_factory_.GetWeakPtr()));
}
protected:
- void Init(dbus::Bus* bus) override { bus_ = bus; }
+ void Init(dbus::Bus* bus) override {
+ bus_ = bus;
+ auth_proxy_ = bus_->GetObjectProxy(
+ kUpstartServiceName, dbus::ObjectPath(kUpstartAuthPolicyPath));
+ }
private:
- void HandleStartResponse(dbus::Response* response) {
+ void HandleAuthResponse(dbus::Response* response) {
LOG_IF(ERROR, !response) << "Failed to signal Upstart, response is null";
}
dbus::Bus* bus_ = nullptr;
+ dbus::ObjectProxy* auth_proxy_ = nullptr;
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
« no previous file with comments | « chromeos/dbus/upstart_client.h ('k') | chromeos/login/auth/authpolicy_login_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698