OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 4 |
5 #include "chromeos/dbus/cryptohome_client.h" | 5 #include "chromeos/dbus/cryptohome_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "chromeos/cryptohome/async_method_caller.h" | 9 #include "chromeos/cryptohome/async_method_caller.h" |
10 #include "chromeos/dbus/blocking_method_caller.h" | 10 #include "chromeos/dbus/blocking_method_caller.h" |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 kStubSystemSalt + arraysize(kStubSystemSalt) - 1); | 851 kStubSystemSalt + arraysize(kStubSystemSalt) - 1); |
852 return true; | 852 return true; |
853 } | 853 } |
854 | 854 |
855 // CryptohomeClient override. | 855 // CryptohomeClient override. |
856 virtual void GetSanitizedUsername( | 856 virtual void GetSanitizedUsername( |
857 const std::string& username, | 857 const std::string& username, |
858 const StringDBusMethodCallback& callback) OVERRIDE { | 858 const StringDBusMethodCallback& callback) OVERRIDE { |
859 // Even for stub implementation we have to return different values | 859 // Even for stub implementation we have to return different values |
860 // so that multi-profiles would work. | 860 // so that multi-profiles would work. |
861 std::string sanitized_username = username + kUserIdStubHashSuffix; | 861 std::string sanitized_username = GetStubSanitizedUsername(username); |
862 MessageLoop::current()->PostTask( | 862 MessageLoop::current()->PostTask( |
863 FROM_HERE, | 863 FROM_HERE, |
864 base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, sanitized_username)); | 864 base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, sanitized_username)); |
865 } | 865 } |
866 | 866 |
867 // CryptohomeClient override. | 867 // CryptohomeClient override. |
868 virtual void AsyncMount(const std::string& username, | 868 virtual void AsyncMount(const std::string& username, |
869 const std::string& key, | 869 const std::string& key, |
870 int flags, | 870 int flags, |
871 const AsyncMethodCallback& callback) OVERRIDE { | 871 const AsyncMethodCallback& callback) OVERRIDE { |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 | 1191 |
1192 // static | 1192 // static |
1193 CryptohomeClient* CryptohomeClient::Create(DBusClientImplementationType type, | 1193 CryptohomeClient* CryptohomeClient::Create(DBusClientImplementationType type, |
1194 dbus::Bus* bus) { | 1194 dbus::Bus* bus) { |
1195 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 1195 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
1196 return new CryptohomeClientImpl(bus); | 1196 return new CryptohomeClientImpl(bus); |
1197 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 1197 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
1198 return new CryptohomeClientStubImpl(); | 1198 return new CryptohomeClientStubImpl(); |
1199 } | 1199 } |
1200 | 1200 |
| 1201 // static |
| 1202 std::string CryptohomeClient::GetStubSanitizedUsername( |
| 1203 const std::string& username) { |
| 1204 return username + kUserIdStubHashSuffix; |
| 1205 } |
| 1206 |
1201 } // namespace chromeos | 1207 } // namespace chromeos |
OLD | NEW |