OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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_NETWORK_CONFIG_MESSAGE_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_NETWORK_CONFIG_MESSAGE_HANDLER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "content/public/browser/web_ui_message_handler.h" |
| 13 |
| 14 namespace base { |
| 15 class DictionaryValue; |
| 16 class ListValue; |
| 17 } |
| 18 |
| 19 namespace chromeos { |
| 20 |
| 21 // This class provides support for network configuration from WebUI components. |
| 22 // It implements network_config.js which is a drop-in replacement for the |
| 23 // networkingPrivate extention API. TODO(stevenjb): Implement the remaining |
| 24 // networkingPrivate methods as needed. |
| 25 class NetworkConfigMessageHandler : public content::WebUIMessageHandler { |
| 26 public: |
| 27 NetworkConfigMessageHandler(); |
| 28 virtual ~NetworkConfigMessageHandler(); |
| 29 |
| 30 // WebUIMessageHandler implementation. |
| 31 virtual void RegisterMessages() OVERRIDE; |
| 32 |
| 33 private: |
| 34 // WebUI::RegisterMessageCallback callbacks. These callbacks collect the |
| 35 // requested information and call the associated JS method. The first |
| 36 // argument in |arg_list| is always the callback id which is passed back |
| 37 // to the callback method. |
| 38 void GetNetworks(const base::ListValue* arg_list) const; |
| 39 void GetProperties(const base::ListValue* arg_list); |
| 40 void GetPropertiesSuccess(int callback_id, |
| 41 const std::string& service_path, |
| 42 const base::DictionaryValue& dictionary) const; |
| 43 void InvokeCallback(const base::ListValue& arg_list) const; |
| 44 void ErrorCallback(int callback_id, |
| 45 const std::string& error_name, |
| 46 scoped_ptr<base::DictionaryValue> error_data) const; |
| 47 |
| 48 base::WeakPtrFactory<NetworkConfigMessageHandler> weak_ptr_factory_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(NetworkConfigMessageHandler); |
| 51 }; |
| 52 |
| 53 } // namespace chromeos |
| 54 |
| 55 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_NETWORK_CONFIG_MESSAGE_HANDLER_H_ |
OLD | NEW |