| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_CRYPTOHOME_WEB_UI_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_CRYPTOHOME_WEB_UI_HANDLER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "chromeos/dbus/cryptohome_client.h" |
| 13 #include "content/public/browser/web_ui_message_handler.h" |
| 14 |
| 15 namespace chromeos { |
| 16 |
| 17 // Class to handle messages from chrome://cryptohome. |
| 18 class CryptohomeWebUIHandler : public content::WebUIMessageHandler { |
| 19 public: |
| 20 CryptohomeWebUIHandler(); |
| 21 |
| 22 virtual ~CryptohomeWebUIHandler(); |
| 23 |
| 24 // WebUIMessageHandler override. |
| 25 virtual void RegisterMessages() OVERRIDE; |
| 26 |
| 27 private: |
| 28 // This method is called from JavaScript. |
| 29 void OnRequestCryptohomeProperty(const base::ListValue* args); |
| 30 |
| 31 // Returns a callback to handle Cryptohome property values. |
| 32 CryptohomeClient::BoolMethodCallback GetCryptohomeBoolCallback( |
| 33 const std::string& destination_id); |
| 34 |
| 35 // This method is called when Cryptohome D-Bus method call completes. |
| 36 void OnCryptohomeBoolProperty(const std::string& destination_id, |
| 37 DBusMethodCallStatus call_status, |
| 38 bool value); |
| 39 |
| 40 // Sets textcontent of the element whose id is |destination_id| to true/false. |
| 41 void SetCryptohomeBoolProperty(const std::string& destination_id, |
| 42 bool value); |
| 43 |
| 44 // Sets textcontent of the element whose id is |destination_id| to |value|. |
| 45 void SetCryptohomeStringProperty(const std::string& destination_id, |
| 46 const std::string& value); |
| 47 |
| 48 base::WeakPtrFactory<CryptohomeWebUIHandler> weak_ptr_factory_; |
| 49 DISALLOW_COPY_AND_ASSIGN(CryptohomeWebUIHandler); |
| 50 }; |
| 51 |
| 52 } // namespace chromeos |
| 53 |
| 54 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_CRYPTOHOME_WEB_UI_HANDLER_H_ |
| OLD | NEW |