| 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 #include "chromeos/dbus/auth_policy_client.h" | 4 #include "chromeos/dbus/auth_policy_client.h" |
| 5 | 5 |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
| 8 #include "components/signin/core/account_id/account_id.h" | 8 #include "components/signin/core/account_id/account_id.h" |
| 9 #include "dbus/bus.h" | 9 #include "dbus/bus.h" |
| 10 #include "dbus/message.h" | 10 #include "dbus/message.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 57 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 58 base::Bind(&AuthPolicyClientImpl::HandleRefreshPolicyCallback, | 58 base::Bind(&AuthPolicyClientImpl::HandleRefreshPolicyCallback, |
| 59 weak_ptr_factory_.GetWeakPtr(), callback)); | 59 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void RefreshUserPolicy(const AccountId& account_id, | 62 void RefreshUserPolicy(const AccountId& account_id, |
| 63 const RefreshPolicyCallback& callback) override { | 63 const RefreshPolicyCallback& callback) override { |
| 64 dbus::MethodCall method_call(authpolicy::kAuthPolicyInterface, | 64 dbus::MethodCall method_call(authpolicy::kAuthPolicyInterface, |
| 65 authpolicy::kAuthPolicyRefreshUserPolicy); | 65 authpolicy::kAuthPolicyRefreshUserPolicy); |
| 66 dbus::MessageWriter writer(&method_call); | 66 dbus::MessageWriter writer(&method_call); |
| 67 writer.AppendString(account_id.GetObjGuid()); | 67 // TODO(tnagel): Switch to GUID once authpolicyd, session_manager and |
| 68 // cryptohome support it, cf. https://crbug.com/677497. |
| 69 writer.AppendString(account_id.GetUserEmail()); |
| 68 proxy_->CallMethod( | 70 proxy_->CallMethod( |
| 69 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 71 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 70 base::Bind(&AuthPolicyClientImpl::HandleRefreshPolicyCallback, | 72 base::Bind(&AuthPolicyClientImpl::HandleRefreshPolicyCallback, |
| 71 weak_ptr_factory_.GetWeakPtr(), callback)); | 73 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 72 } | 74 } |
| 73 | 75 |
| 74 protected: | 76 protected: |
| 75 void Init(dbus::Bus* bus) override { | 77 void Init(dbus::Bus* bus) override { |
| 76 bus_ = bus; | 78 bus_ = bus; |
| 77 proxy_ = bus_->GetObjectProxy( | 79 proxy_ = bus_->GetObjectProxy( |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 AuthPolicyClient::AuthPolicyClient() {} | 152 AuthPolicyClient::AuthPolicyClient() {} |
| 151 | 153 |
| 152 AuthPolicyClient::~AuthPolicyClient() {} | 154 AuthPolicyClient::~AuthPolicyClient() {} |
| 153 | 155 |
| 154 // static | 156 // static |
| 155 AuthPolicyClient* AuthPolicyClient::Create() { | 157 AuthPolicyClient* AuthPolicyClient::Create() { |
| 156 return new AuthPolicyClientImpl(); | 158 return new AuthPolicyClientImpl(); |
| 157 } | 159 } |
| 158 | 160 |
| 159 } // namespace chromeos | 161 } // namespace chromeos |
| OLD | NEW |