| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 dbus::MethodCall method_call(authpolicy::kAuthPolicyInterface, | 64 dbus::MethodCall method_call(authpolicy::kAuthPolicyInterface, |
| 65 authpolicy::kAuthPolicyRefreshDevicePolicy); | 65 authpolicy::kAuthPolicyRefreshDevicePolicy); |
| 66 proxy_->CallMethod( | 66 proxy_->CallMethod( |
| 67 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 67 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 68 base::Bind(&AuthPolicyClientImpl::HandleRefreshPolicyCallback, | 68 base::Bind(&AuthPolicyClientImpl::HandleRefreshPolicyCallback, |
| 69 weak_ptr_factory_.GetWeakPtr(), callback)); | 69 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void RefreshUserPolicy(const AccountId& account_id, | 72 void RefreshUserPolicy(const AccountId& account_id, |
| 73 const RefreshPolicyCallback& callback) override { | 73 const RefreshPolicyCallback& callback) override { |
| 74 DCHECK(account_id.GetAccountType() == AccountType::ACTIVE_DIRECTORY); |
| 74 dbus::MethodCall method_call(authpolicy::kAuthPolicyInterface, | 75 dbus::MethodCall method_call(authpolicy::kAuthPolicyInterface, |
| 75 authpolicy::kAuthPolicyRefreshUserPolicy); | 76 authpolicy::kAuthPolicyRefreshUserPolicy); |
| 76 dbus::MessageWriter writer(&method_call); | 77 dbus::MessageWriter writer(&method_call); |
| 77 // TODO(tnagel): Switch to GUID once authpolicyd, session_manager and | 78 writer.AppendString(account_id.GetAccountIdKey()); |
| 78 // cryptohome support it, cf. https://crbug.com/677497. | |
| 79 writer.AppendString(account_id.GetUserEmail()); | |
| 80 proxy_->CallMethod( | 79 proxy_->CallMethod( |
| 81 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 80 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 82 base::Bind(&AuthPolicyClientImpl::HandleRefreshPolicyCallback, | 81 base::Bind(&AuthPolicyClientImpl::HandleRefreshPolicyCallback, |
| 83 weak_ptr_factory_.GetWeakPtr(), callback)); | 82 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 84 } | 83 } |
| 85 | 84 |
| 86 protected: | 85 protected: |
| 87 void Init(dbus::Bus* bus) override { | 86 void Init(dbus::Bus* bus) override { |
| 88 bus_ = bus; | 87 bus_ = bus; |
| 89 proxy_ = bus_->GetObjectProxy( | 88 proxy_ = bus_->GetObjectProxy( |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 AuthPolicyClient::AuthPolicyClient() {} | 143 AuthPolicyClient::AuthPolicyClient() {} |
| 145 | 144 |
| 146 AuthPolicyClient::~AuthPolicyClient() {} | 145 AuthPolicyClient::~AuthPolicyClient() {} |
| 147 | 146 |
| 148 // static | 147 // static |
| 149 AuthPolicyClient* AuthPolicyClient::Create() { | 148 AuthPolicyClient* AuthPolicyClient::Create() { |
| 150 return new AuthPolicyClientImpl(); | 149 return new AuthPolicyClientImpl(); |
| 151 } | 150 } |
| 152 | 151 |
| 153 } // namespace chromeos | 152 } // namespace chromeos |
| OLD | NEW |