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

Side by Side Diff: chromeos/dbus/auth_policy_client.cc

Issue 2607593002: Add fake implementation for AuthPolicyClient::RefreshUserPolicy() (Closed)
Patch Set: CHECK on serialization errors Created 3 years, 11 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 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 "dbus/bus.h" 9 #include "dbus/bus.h"
9 #include "dbus/message.h" 10 #include "dbus/message.h"
10 #include "dbus/object_proxy.h" 11 #include "dbus/object_proxy.h"
11 #include "third_party/cros_system_api/dbus/service_constants.h" 12 #include "third_party/cros_system_api/dbus/service_constants.h"
12 13
13 namespace chromeos { 14 namespace chromeos {
14 15
15 namespace { 16 namespace {
16 17
17 class AuthPolicyClientImpl : public AuthPolicyClient { 18 class AuthPolicyClientImpl : public AuthPolicyClient {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 52
52 void RefreshDevicePolicy(const RefreshPolicyCallback& callback) override { 53 void RefreshDevicePolicy(const RefreshPolicyCallback& callback) override {
53 dbus::MethodCall method_call(authpolicy::kAuthPolicyInterface, 54 dbus::MethodCall method_call(authpolicy::kAuthPolicyInterface,
54 authpolicy::kAuthPolicyRefreshDevicePolicy); 55 authpolicy::kAuthPolicyRefreshDevicePolicy);
55 proxy_->CallMethod( 56 proxy_->CallMethod(
56 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 57 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
57 base::Bind(&AuthPolicyClientImpl::HandleRefreshPolicyCallback, 58 base::Bind(&AuthPolicyClientImpl::HandleRefreshPolicyCallback,
58 weak_ptr_factory_.GetWeakPtr(), callback)); 59 weak_ptr_factory_.GetWeakPtr(), callback));
59 } 60 }
60 61
61 void RefreshUserPolicy(const std::string& account_id, 62 void RefreshUserPolicy(const AccountId& account_id,
62 const RefreshPolicyCallback& callback) override { 63 const RefreshPolicyCallback& callback) override {
63 dbus::MethodCall method_call(authpolicy::kAuthPolicyInterface, 64 dbus::MethodCall method_call(authpolicy::kAuthPolicyInterface,
64 authpolicy::kAuthPolicyRefreshUserPolicy); 65 authpolicy::kAuthPolicyRefreshUserPolicy);
65 dbus::MessageWriter writer(&method_call); 66 dbus::MessageWriter writer(&method_call);
66 writer.AppendString(account_id); 67 writer.AppendString(account_id.GetObjGuid());
67 proxy_->CallMethod( 68 proxy_->CallMethod(
68 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 69 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
69 base::Bind(&AuthPolicyClientImpl::HandleRefreshPolicyCallback, 70 base::Bind(&AuthPolicyClientImpl::HandleRefreshPolicyCallback,
70 weak_ptr_factory_.GetWeakPtr(), callback)); 71 weak_ptr_factory_.GetWeakPtr(), callback));
71 } 72 }
72 73
73 protected: 74 protected:
74 void Init(dbus::Bus* bus) override { 75 void Init(dbus::Bus* bus) override {
75 bus_ = bus; 76 bus_ = bus;
76 proxy_ = bus_->GetObjectProxy( 77 proxy_ = bus_->GetObjectProxy(
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 AuthPolicyClient::AuthPolicyClient() {} 150 AuthPolicyClient::AuthPolicyClient() {}
150 151
151 AuthPolicyClient::~AuthPolicyClient() {} 152 AuthPolicyClient::~AuthPolicyClient() {}
152 153
153 // static 154 // static
154 AuthPolicyClient* AuthPolicyClient::Create() { 155 AuthPolicyClient* AuthPolicyClient::Create() {
155 return new AuthPolicyClientImpl(); 156 return new AuthPolicyClientImpl();
156 } 157 }
157 158
158 } // namespace chromeos 159 } // namespace chromeos
OLDNEW
« 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