OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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 // These classes implement the chrome.networkingPrivate JavaScript extension | |
6 // API. | |
7 | |
8 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_API_H_ | |
9 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_API_H_ | |
10 | |
11 #include <string> | |
12 | |
13 #include "base/memory/ref_counted.h" | |
14 #include "base/values.h" | |
15 #include "chrome/browser/extensions/extension_function.h" | |
16 #include "chrome/browser/profiles/profile_keyed_service.h" | |
17 #include "chromeos/dbus/dbus_method_call_status.h" | |
18 | |
19 // Implements the chrome.networkingPrivate.getProperties method. | |
20 class NetworkingPrivateGetPropertiesFunction : public AsyncExtensionFunction { | |
21 public: | |
22 NetworkingPrivateGetPropertiesFunction() {} | |
23 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getProperties", | |
24 NETWORKINGPRIVATE_GETPROPERTIES); | |
25 | |
26 protected: | |
27 virtual ~NetworkingPrivateGetPropertiesFunction(); | |
28 | |
29 // AsyncExtensionFunction overrides. | |
30 virtual bool RunImpl() OVERRIDE; | |
31 | |
32 private: | |
33 void ResultCallback(chromeos::DBusMethodCallStatus call_status, | |
34 const base::DictionaryValue& result); | |
35 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetPropertiesFunction); | |
36 }; | |
37 | |
38 // Implements the chrome.networkingPrivate.getVisibleNetworks method. | |
39 class NetworkingPrivateGetVisibleNetworksFunction | |
40 : public AsyncExtensionFunction { | |
41 public: | |
42 NetworkingPrivateGetVisibleNetworksFunction() {} | |
43 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getVisibleNetworks", | |
44 NETWORKINGPRIVATE_GETVISIBLENETWORKS); | |
45 | |
46 protected: | |
47 virtual ~NetworkingPrivateGetVisibleNetworksFunction(); | |
48 | |
49 // AsyncExtensionFunction overrides. | |
50 virtual bool RunImpl() OVERRIDE; | |
51 | |
52 private: | |
53 class ResultList; | |
54 | |
55 void ManagerPropertiesCallback(const std::string& network_type, | |
56 chromeos::DBusMethodCallStatus call_status, | |
57 const base::DictionaryValue& result); | |
58 | |
59 void ServicePropertiesCallback(const std::string& service_path, | |
60 const std::string& network_type, | |
61 scoped_refptr<ResultList> result_list, | |
62 chromeos::DBusMethodCallStatus call_status, | |
63 const base::DictionaryValue& result); | |
64 | |
65 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetVisibleNetworksFunction); | |
66 }; | |
67 | |
68 // Implements the chrome.networkingPrivate.requestConnect method. | |
69 class NetworkingPrivateRequestConnectFunction : public AsyncExtensionFunction { | |
70 public: | |
71 NetworkingPrivateRequestConnectFunction() {} | |
72 DECLARE_EXTENSION_FUNCTION("networkingPrivate.requestConnect", | |
73 NETWORKINGPRIVATE_REQUESTCONNECT); | |
74 | |
75 protected: | |
76 virtual ~NetworkingPrivateRequestConnectFunction(); | |
77 | |
78 // AsyncExtensionFunction overrides. | |
79 virtual bool RunImpl() OVERRIDE; | |
80 | |
81 private: | |
82 // Called when the request to connect succeeds. Doesn't mean that the connect | |
83 // itself succeeded, just that the request did. | |
84 void ConnectRequestSuccess(); | |
85 | |
86 void ConnectRequestFailed(const std::string& errorName, | |
87 const std::string& errorMessage); | |
not at google - send to devlin
2013/02/01 19:09:42
error_name, error_message, same below in Disconnec
| |
88 | |
89 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateRequestConnectFunction); | |
90 }; | |
91 | |
92 // Implements the chrome.networkingPrivate.requestDisconnect method. | |
93 class NetworkingPrivateRequestDisconnectFunction | |
94 : public AsyncExtensionFunction { | |
95 public: | |
96 NetworkingPrivateRequestDisconnectFunction() {} | |
97 DECLARE_EXTENSION_FUNCTION("networkingPrivate.requestDisconnect", | |
98 NETWORKINGPRIVATE_REQUESTDISCONNECT); | |
99 | |
100 protected: | |
101 virtual ~NetworkingPrivateRequestDisconnectFunction(); | |
102 | |
103 // AsyncExtensionFunction overrides. | |
104 virtual bool RunImpl() OVERRIDE; | |
105 | |
106 private: | |
107 // Called when the request to disconnect succeeds. Doesn't mean that the | |
108 // disconnect itself succeeded, just that the request did. | |
109 void DisconnectRequestSuccess(); | |
110 | |
111 void DisconnectRequestFailed(const std::string& errorName, | |
112 const std::string& errorMessage); | |
113 | |
114 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateRequestDisconnectFunction); | |
115 }; | |
116 | |
117 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_API_H_ | |
OLD | NEW |