| 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 base { |
| 16 |
| 17 class Value; |
| 18 |
| 19 } // base |
| 20 |
| 21 namespace chromeos { |
| 22 |
| 23 // Class to handle messages from chrome://cryptohome. |
| 24 class CryptohomeWebUIHandler : public content::WebUIMessageHandler { |
| 25 public: |
| 26 CryptohomeWebUIHandler(); |
| 27 |
| 28 virtual ~CryptohomeWebUIHandler(); |
| 29 |
| 30 // WebUIMessageHandler override. |
| 31 virtual void RegisterMessages() OVERRIDE; |
| 32 |
| 33 private: |
| 34 // This method is called from JavaScript. |
| 35 void OnPageLoaded(const base::ListValue* args); |
| 36 |
| 37 // Returns a callback to handle Cryptohome property values. |
| 38 CryptohomeClient::BoolMethodCallback GetCryptohomeBoolCallback( |
| 39 const std::string& destination_id); |
| 40 |
| 41 // This method is called when Cryptohome D-Bus method call completes. |
| 42 void OnCryptohomeBoolProperty(const std::string& destination_id, |
| 43 DBusMethodCallStatus call_status, |
| 44 bool value); |
| 45 |
| 46 // Sets textcontent of the element whose id is |destination_id| to |value|. |
| 47 void SetCryptohomeProperty(const std::string& destination_id, |
| 48 const base::Value& value); |
| 49 |
| 50 base::WeakPtrFactory<CryptohomeWebUIHandler> weak_ptr_factory_; |
| 51 DISALLOW_COPY_AND_ASSIGN(CryptohomeWebUIHandler); |
| 52 }; |
| 53 |
| 54 } // namespace chromeos |
| 55 |
| 56 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_CRYPTOHOME_WEB_UI_HANDLER_H_ |
| OLD | NEW |