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 ~NetworkConfigMessageHandler() override; | |
29 | |
30 // WebUIMessageHandler implementation. | |
31 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 GetManagedProperties(const base::ListValue* arg_list); | |
41 void GetPropertiesSuccess(int callback_id, | |
42 const std::string& service_path, | |
43 const base::DictionaryValue& dictionary) const; | |
44 | |
45 // Get Shill Properties for debugging purposes only. | |
46 void GetShillProperties(const base::ListValue* arg_list); | |
47 void GetShillPropertiesSuccess(int callback_id, | |
48 const std::string& service_path, | |
49 const base::DictionaryValue& dictionary) const; | |
50 | |
51 void InvokeCallback(const base::ListValue& arg_list) const; | |
52 void ErrorCallback(int callback_id, | |
53 const std::string& error_name, | |
54 scoped_ptr<base::DictionaryValue> error_data) const; | |
55 | |
56 base::WeakPtrFactory<NetworkConfigMessageHandler> weak_ptr_factory_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(NetworkConfigMessageHandler); | |
59 }; | |
60 | |
61 } // namespace chromeos | |
62 | |
63 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_NETWORK_CONFIG_MESSAGE_HANDLER_H_ | |
OLD | NEW |