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/ui/webui/chromeos/cryptohome_web_ui_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/chromeos/cros/cros_library.h" | 9 #include "chrome/browser/chromeos/cros/cros_library.h" |
10 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 10 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 base::Bind(&CryptohomeWebUIHandler::OnPageLoaded, | 24 base::Bind(&CryptohomeWebUIHandler::OnPageLoaded, |
25 weak_ptr_factory_.GetWeakPtr())); | 25 weak_ptr_factory_.GetWeakPtr())); |
26 } | 26 } |
27 | 27 |
28 void CryptohomeWebUIHandler::OnPageLoaded(const base::ListValue* args) { | 28 void CryptohomeWebUIHandler::OnPageLoaded(const base::ListValue* args) { |
29 CryptohomeClient* cryptohome_client = | 29 CryptohomeClient* cryptohome_client = |
30 DBusThreadManager::Get()->GetCryptohomeClient(); | 30 DBusThreadManager::Get()->GetCryptohomeClient(); |
31 CryptohomeLibrary* cryptohome_library = | 31 CryptohomeLibrary* cryptohome_library = |
32 CrosLibrary::Get()->GetCryptohomeLibrary(); | 32 CrosLibrary::Get()->GetCryptohomeLibrary(); |
33 | 33 |
34 base::FundamentalValue is_mounted(cryptohome_library->IsMounted()); | 34 cryptohome_client->IsMounted(GetCryptohomeBoolCallback("is-mounted")); |
35 SetCryptohomeProperty("is-mounted", is_mounted); | |
36 cryptohome_client->TpmIsReady(GetCryptohomeBoolCallback("tpm-is-ready")); | 35 cryptohome_client->TpmIsReady(GetCryptohomeBoolCallback("tpm-is-ready")); |
37 base::FundamentalValue tpm_is_enabled(cryptohome_library->TpmIsEnabled()); | 36 base::FundamentalValue tpm_is_enabled(cryptohome_library->TpmIsEnabled()); |
38 SetCryptohomeProperty("tpm-is-enabled", tpm_is_enabled); | 37 SetCryptohomeProperty("tpm-is-enabled", tpm_is_enabled); |
39 base::FundamentalValue tpm_is_owned(cryptohome_library->TpmIsOwned()); | 38 base::FundamentalValue tpm_is_owned(cryptohome_library->TpmIsOwned()); |
40 SetCryptohomeProperty("tpm-is-owned", tpm_is_owned); | 39 SetCryptohomeProperty("tpm-is-owned", tpm_is_owned); |
41 base::FundamentalValue tpm_is_being_owned( | 40 base::FundamentalValue tpm_is_being_owned( |
42 cryptohome_library->TpmIsBeingOwned()); | 41 cryptohome_library->TpmIsBeingOwned()); |
43 SetCryptohomeProperty("tpm-is-being-owned", tpm_is_being_owned); | 42 SetCryptohomeProperty("tpm-is-being-owned", tpm_is_being_owned); |
44 cryptohome_client->Pkcs11IsTpmTokenReady( | 43 cryptohome_client->Pkcs11IsTpmTokenReady( |
45 GetCryptohomeBoolCallback("pkcs11-is-tpm-token-ready")); | 44 GetCryptohomeBoolCallback("pkcs11-is-tpm-token-ready")); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 78 |
80 void CryptohomeWebUIHandler::SetCryptohomeProperty( | 79 void CryptohomeWebUIHandler::SetCryptohomeProperty( |
81 const std::string& destination_id, | 80 const std::string& destination_id, |
82 const base::Value& value) { | 81 const base::Value& value) { |
83 base::StringValue destination_id_value(destination_id); | 82 base::StringValue destination_id_value(destination_id); |
84 web_ui()->CallJavascriptFunction( | 83 web_ui()->CallJavascriptFunction( |
85 "SetCryptohomeProperty", destination_id_value, value); | 84 "SetCryptohomeProperty", destination_id_value, value); |
86 } | 85 } |
87 | 86 |
88 } // namespace chromeos | 87 } // namespace chromeos |
OLD | NEW |