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 "chrome/browser/chromeos/dbus/cryptohome_client.h" | 5 #include "chrome/browser/chromeos/dbus/cryptohome_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
9 #include "chrome/browser/chromeos/system/runtime_environment.h" | 9 #include "chrome/browser/chromeos/system/runtime_environment.h" |
10 #include "dbus/bus.h" | 10 #include "dbus/bus.h" |
11 #include "dbus/message.h" | 11 #include "dbus/message.h" |
| 12 #include "dbus/object_path.h" |
12 #include "dbus/object_proxy.h" | 13 #include "dbus/object_proxy.h" |
13 #include "third_party/cros_system_api/dbus/service_constants.h" | 14 #include "third_party/cros_system_api/dbus/service_constants.h" |
14 | 15 |
15 namespace chromeos { | 16 namespace chromeos { |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
19 // A convenient macro to initialize a dbus::MethodCall while checking the dbus | 20 // A convenient macro to initialize a dbus::MethodCall while checking the dbus |
20 // method name matches to the C++ method name. | 21 // method name matches to the C++ method name. |
21 #define INITIALIZE_METHOD_CALL(method_call_name, method_name) \ | 22 #define INITIALIZE_METHOD_CALL(method_call_name, method_name) \ |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 base::Callback<bool(dbus::MessageReader* reader)> popper2, | 58 base::Callback<bool(dbus::MessageReader* reader)> popper2, |
58 dbus::MessageReader* reader) { | 59 dbus::MessageReader* reader) { |
59 return popper1.Run(reader) && popper2.Run(reader); | 60 return popper1.Run(reader) && popper2.Run(reader); |
60 } | 61 } |
61 | 62 |
62 // The CryptohomeClient implementation. | 63 // The CryptohomeClient implementation. |
63 class CryptohomeClientImpl : public CryptohomeClient { | 64 class CryptohomeClientImpl : public CryptohomeClient { |
64 public: | 65 public: |
65 explicit CryptohomeClientImpl(dbus::Bus* bus) | 66 explicit CryptohomeClientImpl(dbus::Bus* bus) |
66 : bus_(bus), | 67 : bus_(bus), |
67 proxy_(bus->GetObjectProxy(cryptohome::kCryptohomeServiceName, | 68 proxy_(bus->GetObjectProxy( |
68 cryptohome::kCryptohomeServicePath)), | 69 cryptohome::kCryptohomeServiceName, |
| 70 dbus::ObjectPath(cryptohome::kCryptohomeServicePath))), |
69 weak_ptr_factory_(this), | 71 weak_ptr_factory_(this), |
70 on_blocking_method_call_(false /* manual_reset */, | 72 on_blocking_method_call_(false /* manual_reset */, |
71 false /* initially_signaled */) { | 73 false /* initially_signaled */) { |
72 proxy_->ConnectToSignal( | 74 proxy_->ConnectToSignal( |
73 cryptohome::kCryptohomeInterface, | 75 cryptohome::kCryptohomeInterface, |
74 cryptohome::kSignalAsyncCallStatus, | 76 cryptohome::kSignalAsyncCallStatus, |
75 base::Bind(&CryptohomeClientImpl::OnAsyncCallStatus, | 77 base::Bind(&CryptohomeClientImpl::OnAsyncCallStatus, |
76 weak_ptr_factory_.GetWeakPtr()), | 78 weak_ptr_factory_.GetWeakPtr()), |
77 base::Bind(&CryptohomeClientImpl::OnSignalConnected, | 79 base::Bind(&CryptohomeClientImpl::OnSignalConnected, |
78 weak_ptr_factory_.GetWeakPtr())); | 80 weak_ptr_factory_.GetWeakPtr())); |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 | 575 |
574 // static | 576 // static |
575 CryptohomeClient* CryptohomeClient::Create(dbus::Bus* bus) { | 577 CryptohomeClient* CryptohomeClient::Create(dbus::Bus* bus) { |
576 if (system::runtime_environment::IsRunningOnChromeOS()) | 578 if (system::runtime_environment::IsRunningOnChromeOS()) |
577 return new CryptohomeClientImpl(bus); | 579 return new CryptohomeClientImpl(bus); |
578 else | 580 else |
579 return new CryptohomeClientStubImpl(); | 581 return new CryptohomeClientStubImpl(); |
580 } | 582 } |
581 | 583 |
582 } // namespace chromeos | 584 } // namespace chromeos |
OLD | NEW |