| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "dbus/bus.h" | 8 #include "dbus/bus.h" |
| 9 #include "dbus/message.h" | 9 #include "dbus/message.h" |
| 10 #include "dbus/object_proxy.h" | 10 #include "dbus/object_proxy.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 return; | 74 return; |
| 75 } | 75 } |
| 76 callback.Run(true); | 76 callback.Run(true); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void HandleJoinCallback(const JoinCallback& callback, | 79 void HandleJoinCallback(const JoinCallback& callback, |
| 80 dbus::Response* response) { | 80 dbus::Response* response) { |
| 81 if (!response) { | 81 if (!response) { |
| 82 LOG(ERROR) << "Join: Couldn't call to authpolicy"; | 82 LOG(ERROR) << "Join: Couldn't call to authpolicy"; |
| 83 // TODO(rsorokin): make proper call, after defining possible errors codes. | 83 // TODO(rsorokin): make proper call, after defining possible errors codes. |
| 84 callback.Run(authpolicy::AD_JOIN_ERROR_UNKNOWN); | 84 callback.Run(authpolicy::types::AD_JOIN_ERROR_UNKNOWN); |
| 85 return; | 85 return; |
| 86 } | 86 } |
| 87 | 87 |
| 88 dbus::MessageReader reader(response); | 88 dbus::MessageReader reader(response); |
| 89 int res = authpolicy::AD_JOIN_ERROR_UNKNOWN; | 89 int res = authpolicy::types::AD_JOIN_ERROR_UNKNOWN; |
| 90 if (!reader.PopInt32(&res)) { | 90 if (!reader.PopInt32(&res)) { |
| 91 LOG(ERROR) << "Join: Couldn't get an error from the response"; | 91 LOG(ERROR) << "Join: Couldn't get an error from the response"; |
| 92 // TODO(rsorokin): make proper call, after defining possible errors codes. | 92 // TODO(rsorokin): make proper call, after defining possible errors codes. |
| 93 callback.Run(authpolicy::AD_JOIN_ERROR_DBUS_FAIL); | 93 callback.Run(authpolicy::types::AD_JOIN_ERROR_DBUS_FAIL); |
| 94 return; | 94 return; |
| 95 } | 95 } |
| 96 | 96 |
| 97 callback.Run(res); | 97 callback.Run(res); |
| 98 } | 98 } |
| 99 | 99 |
| 100 dbus::Bus* bus_ = nullptr; | 100 dbus::Bus* bus_ = nullptr; |
| 101 dbus::ObjectProxy* proxy_ = nullptr; | 101 dbus::ObjectProxy* proxy_ = nullptr; |
| 102 | 102 |
| 103 // Note: This should remain the last member so it'll be destroyed and | 103 // Note: This should remain the last member so it'll be destroyed and |
| 104 // invalidate its weak pointers before any other members are destroyed. | 104 // invalidate its weak pointers before any other members are destroyed. |
| 105 base::WeakPtrFactory<AuthPolicyClientImpl> weak_ptr_factory_; | 105 base::WeakPtrFactory<AuthPolicyClientImpl> weak_ptr_factory_; |
| 106 | 106 |
| 107 DISALLOW_COPY_AND_ASSIGN(AuthPolicyClientImpl); | 107 DISALLOW_COPY_AND_ASSIGN(AuthPolicyClientImpl); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 } // namespace | 110 } // namespace |
| 111 | 111 |
| 112 AuthPolicyClient::AuthPolicyClient() {} | 112 AuthPolicyClient::AuthPolicyClient() {} |
| 113 | 113 |
| 114 AuthPolicyClient::~AuthPolicyClient() {} | 114 AuthPolicyClient::~AuthPolicyClient() {} |
| 115 | 115 |
| 116 // static | 116 // static |
| 117 AuthPolicyClient* AuthPolicyClient::Create() { | 117 AuthPolicyClient* AuthPolicyClient::Create() { |
| 118 return new AuthPolicyClientImpl(); | 118 return new AuthPolicyClientImpl(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace chromeos | 121 } // namespace chromeos |
| OLD | NEW |