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 // Gets called when all the results are in. | |
53 void SendResultCallback(const std::string& error, | |
54 scoped_ptr<base::ListValue> result_list); | |
55 | |
56 private: | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetVisibleNetworksFunction); | |
59 }; | |
60 | |
61 // Implements the chrome.networkingPrivate.startConnect method. | |
62 class NetworkingPrivateStartConnectFunction : public AsyncExtensionFunction { | |
63 public: | |
64 NetworkingPrivateStartConnectFunction() {} | |
65 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startConnect", | |
66 NETWORKINGPRIVATE_STARTCONNECT); | |
67 | |
68 protected: | |
69 virtual ~NetworkingPrivateStartConnectFunction(); | |
70 | |
71 // AsyncExtensionFunction overrides. | |
72 virtual bool RunImpl() OVERRIDE; | |
73 | |
74 private: | |
75 // Called when the request to connect succeeds. Doesn't mean that the connect | |
76 // itself succeeded, just that the request did. | |
77 void ConnectionStartSuccess(); | |
78 | |
79 void ConnectionStartFailed(const std::string& errorName, | |
not at google - send to devlin
2013/02/02 01:08:17
error_name
Greg Spencer (Chromium)
2013/02/02 01:19:56
Gah! Hopefully I've got all of these now. I think
| |
80 const std::string& errorMessage); | |
not at google - send to devlin
2013/02/02 01:08:17
error_message
| |
81 | |
82 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartConnectFunction); | |
83 }; | |
84 | |
85 // Implements the chrome.networkingPrivate.startDisconnect method. | |
86 class NetworkingPrivateStartDisconnectFunction | |
87 : public AsyncExtensionFunction { | |
88 public: | |
89 NetworkingPrivateStartDisconnectFunction() {} | |
90 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startDisconnect", | |
91 NETWORKINGPRIVATE_STARTDISCONNECT); | |
92 | |
93 protected: | |
94 virtual ~NetworkingPrivateStartDisconnectFunction(); | |
95 | |
96 // AsyncExtensionFunction overrides. | |
97 virtual bool RunImpl() OVERRIDE; | |
98 | |
99 private: | |
100 // Called when the request to disconnect succeeds. Doesn't mean that the | |
101 // disconnect itself succeeded, just that the request did. | |
102 void DisconnectionStartSuccess(); | |
103 | |
104 void DisconnectionStartFailed(const std::string& errorName, | |
not at google - send to devlin
2013/02/02 01:08:17
error_name
| |
105 const std::string& errorMessage); | |
not at google - send to devlin
2013/02/02 01:08:17
error_message
| |
106 | |
107 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartDisconnectFunction); | |
108 }; | |
109 | |
110 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_API_H_ | |
OLD | NEW |