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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_CRYPTOHOME_WEB_UI_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_CRYPTOHOME_WEB_UI_HANDLER_H_
10 #include "base/basictypes.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chromeos/dbus/dbus_method_call_status.h"
13 #include "content/public/browser/web_ui_message_handler.h"
23 // Class to handle messages from chrome://cryptohome.
24 class CryptohomeWebUIHandler
: public content::WebUIMessageHandler
{
26 CryptohomeWebUIHandler();
28 ~CryptohomeWebUIHandler() override
;
30 // WebUIMessageHandler override.
31 void RegisterMessages() override
;
34 // This method is called from JavaScript.
35 void OnPageLoaded(const base::ListValue
* args
);
37 void DidGetNSSUtilInfoOnUIThread(bool is_tpm_token_ready
);
39 // Returns a callback to handle Cryptohome property values.
40 BoolDBusMethodCallback
GetCryptohomeBoolCallback(
41 const std::string
& destination_id
);
43 // This method is called when Cryptohome D-Bus method call completes.
44 void OnCryptohomeBoolProperty(const std::string
& destination_id
,
45 DBusMethodCallStatus call_status
,
48 // Sets textcontent of the element whose id is |destination_id| to |value|.
49 void SetCryptohomeProperty(const std::string
& destination_id
,
50 const base::Value
& value
);
52 base::WeakPtrFactory
<CryptohomeWebUIHandler
> weak_ptr_factory_
;
53 DISALLOW_COPY_AND_ASSIGN(CryptohomeWebUIHandler
);
56 } // namespace chromeos
58 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_CRYPTOHOME_WEB_UI_HANDLER_H_