OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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_cryptohome.h" // NOLINT | 5 #include "chromeos_cryptohome.h" // NOLINT |
6 | 6 |
7 #include <base/basictypes.h> | 7 #include <base/basictypes.h> |
8 #include <base/string_util.h> | 8 #include <base/string_util.h> |
9 #include <dbus/dbus-glib-lowlevel.h> | 9 #include <dbus/dbus-glib-lowlevel.h> |
10 #include <chromeos/dbus/dbus.h> | 10 #include <chromeos/dbus/dbus.h> |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 &async_call_id, | 561 &async_call_id, |
562 G_TYPE_INVALID)) { | 562 G_TYPE_INVALID)) { |
563 LOG(WARNING) << cryptohome::kCryptohomeAsyncRemoveTrackedSubdirectories | 563 LOG(WARNING) << cryptohome::kCryptohomeAsyncRemoveTrackedSubdirectories |
564 << " failed: " | 564 << " failed: " |
565 << (error->message ? error->message : "Unknown Error."); | 565 << (error->message ? error->message : "Unknown Error."); |
566 } | 566 } |
567 return async_call_id; | 567 return async_call_id; |
568 } | 568 } |
569 | 569 |
570 extern "C" | 570 extern "C" |
| 571 bool ChromeOSCryptohomeDoAutomaticFreeDiskSpaceControl() { |
| 572 dbus::BusConnection bus = dbus::GetSystemBusConnection(); |
| 573 dbus::Proxy proxy(bus, |
| 574 cryptohome::kCryptohomeServiceName, |
| 575 cryptohome::kCryptohomeServicePath, |
| 576 cryptohome::kCryptohomeInterface); |
| 577 gboolean done = false; |
| 578 glib::ScopedError error; |
| 579 |
| 580 if (!::dbus_g_proxy_call( |
| 581 proxy.gproxy(), |
| 582 cryptohome::kCryptohomeDoAutomaticFreeDiskSpaceControl, |
| 583 &Resetter(&error).lvalue(), |
| 584 G_TYPE_INVALID, |
| 585 G_TYPE_BOOLEAN, |
| 586 &done, |
| 587 G_TYPE_INVALID)) { |
| 588 LOG(WARNING) << cryptohome::kCryptohomeDoAutomaticFreeDiskSpaceControl |
| 589 << " failed: " |
| 590 << (error->message ? error->message : "Unknown Error."); |
| 591 } |
| 592 return done; |
| 593 } |
| 594 |
| 595 extern "C" |
| 596 int ChromeOSCryptohomeAsyncDoAutomaticFreeDiskSpaceControl() { |
| 597 dbus::BusConnection bus = dbus::GetSystemBusConnection(); |
| 598 dbus::Proxy proxy(bus, |
| 599 cryptohome::kCryptohomeServiceName, |
| 600 cryptohome::kCryptohomeServicePath, |
| 601 cryptohome::kCryptohomeInterface); |
| 602 gint async_call_id = 0; |
| 603 glib::ScopedError error; |
| 604 |
| 605 if (!::dbus_g_proxy_call(proxy.gproxy(), |
| 606 cryptohome::kCryptohomeAsyncDoAutomaticFreeDiskSpaceControl, |
| 607 &Resetter(&error).lvalue(), |
| 608 G_TYPE_INVALID, |
| 609 G_TYPE_INT, |
| 610 &async_call_id, |
| 611 G_TYPE_INVALID)) { |
| 612 LOG(WARNING) << cryptohome::kCryptohomeAsyncDoAutomaticFreeDiskSpaceControl |
| 613 << " failed: " |
| 614 << (error->message ? error->message : "Unknown Error."); |
| 615 } |
| 616 return async_call_id; |
| 617 } |
| 618 |
| 619 extern "C" |
571 bool ChromeOSCryptohomeTpmIsReady() { | 620 bool ChromeOSCryptohomeTpmIsReady() { |
572 dbus::BusConnection bus = dbus::GetSystemBusConnection(); | 621 dbus::BusConnection bus = dbus::GetSystemBusConnection(); |
573 dbus::Proxy proxy(bus, | 622 dbus::Proxy proxy(bus, |
574 cryptohome::kCryptohomeServiceName, | 623 cryptohome::kCryptohomeServiceName, |
575 cryptohome::kCryptohomeServicePath, | 624 cryptohome::kCryptohomeServicePath, |
576 cryptohome::kCryptohomeInterface); | 625 cryptohome::kCryptohomeInterface); |
577 gboolean done = false; | 626 gboolean done = false; |
578 glib::ScopedError error; | 627 glib::ScopedError error; |
579 | 628 |
580 if (!::dbus_g_proxy_call(proxy.gproxy(), | 629 if (!::dbus_g_proxy_call(proxy.gproxy(), |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 DBusConnection *dbus_connection = ::dbus_g_connection_get_connection( | 958 DBusConnection *dbus_connection = ::dbus_g_connection_get_connection( |
910 dbus::GetSystemBusConnection().g_connection()); | 959 dbus::GetSystemBusConnection().g_connection()); |
911 ::dbus_connection_remove_filter(dbus_connection, | 960 ::dbus_connection_remove_filter(dbus_connection, |
912 &CryptohomeSignalFilter, | 961 &CryptohomeSignalFilter, |
913 connection); | 962 connection); |
914 delete self; | 963 delete self; |
915 LOG(INFO) << "Disconnected from Cryptohome event monitoring"; | 964 LOG(INFO) << "Disconnected from Cryptohome event monitoring"; |
916 } | 965 } |
917 | 966 |
918 } // namespace chromeos | 967 } // namespace chromeos |
OLD | NEW |