Chromium Code Reviews| Index: chrome/browser/chromeos/extensions/networking_private_api.h |
| diff --git a/chrome/browser/chromeos/extensions/networking_private_api.h b/chrome/browser/chromeos/extensions/networking_private_api.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..19bf680d8532d6b413a444a396453617d652d28f |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/extensions/networking_private_api.h |
| @@ -0,0 +1,117 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// These classes implement the chrome.networkingPrivate JavaScript extension |
| +// API. |
| + |
| +#ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_API_H_ |
| +#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_API_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/values.h" |
| +#include "chrome/browser/extensions/extension_function.h" |
| +#include "chrome/browser/profiles/profile_keyed_service.h" |
| +#include "chromeos/dbus/dbus_method_call_status.h" |
| + |
| +// Implements the chrome.networkingPrivate.getProperties method. |
| +class NetworkingPrivateGetPropertiesFunction : public AsyncExtensionFunction { |
| + public: |
| + NetworkingPrivateGetPropertiesFunction() {} |
| + DECLARE_EXTENSION_FUNCTION("networkingPrivate.getProperties", |
| + NETWORKINGPRIVATE_GETPROPERTIES); |
| + |
| + protected: |
| + virtual ~NetworkingPrivateGetPropertiesFunction(); |
| + |
| + // AsyncExtensionFunction overrides. |
| + virtual bool RunImpl() OVERRIDE; |
| + |
| + private: |
| + void ResultCallback(chromeos::DBusMethodCallStatus call_status, |
| + const base::DictionaryValue& result); |
| + DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetPropertiesFunction); |
| +}; |
| + |
| +// Implements the chrome.networkingPrivate.getVisibleNetworks method. |
| +class NetworkingPrivateGetVisibleNetworksFunction |
| + : public AsyncExtensionFunction { |
| + public: |
| + NetworkingPrivateGetVisibleNetworksFunction() {} |
| + DECLARE_EXTENSION_FUNCTION("networkingPrivate.getVisibleNetworks", |
| + NETWORKINGPRIVATE_GETVISIBLENETWORKS); |
| + |
| + protected: |
| + virtual ~NetworkingPrivateGetVisibleNetworksFunction(); |
| + |
| + // AsyncExtensionFunction overrides. |
| + virtual bool RunImpl() OVERRIDE; |
| + |
| + private: |
| + class ResultList; |
| + |
| + void ManagerPropertiesCallback(const std::string& network_type, |
| + chromeos::DBusMethodCallStatus call_status, |
| + const base::DictionaryValue& result); |
| + |
| + void ServicePropertiesCallback(const std::string& service_path, |
| + const std::string& network_type, |
| + scoped_refptr<ResultList> result_list, |
| + chromeos::DBusMethodCallStatus call_status, |
| + const base::DictionaryValue& result); |
| + |
| + DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetVisibleNetworksFunction); |
| +}; |
| + |
| +// Implements the chrome.networkingPrivate.requestConnect method. |
| +class NetworkingPrivateRequestConnectFunction : public AsyncExtensionFunction { |
| + public: |
| + NetworkingPrivateRequestConnectFunction() {} |
| + DECLARE_EXTENSION_FUNCTION("networkingPrivate.requestConnect", |
| + NETWORKINGPRIVATE_REQUESTCONNECT); |
| + |
| + protected: |
| + virtual ~NetworkingPrivateRequestConnectFunction(); |
| + |
| + // AsyncExtensionFunction overrides. |
| + virtual bool RunImpl() OVERRIDE; |
| + |
| + private: |
| + // Called when the request to connect succeeds. Doesn't mean that the connect |
| + // itself succeeded, just that the request did. |
| + void ConnectRequestSuccess(); |
| + |
| + void ConnectRequestFailed(const std::string& errorName, |
| + const std::string& errorMessage); |
|
not at google - send to devlin
2013/02/01 19:09:42
error_name, error_message, same below in Disconnec
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateRequestConnectFunction); |
| +}; |
| + |
| +// Implements the chrome.networkingPrivate.requestDisconnect method. |
| +class NetworkingPrivateRequestDisconnectFunction |
| + : public AsyncExtensionFunction { |
| + public: |
| + NetworkingPrivateRequestDisconnectFunction() {} |
| + DECLARE_EXTENSION_FUNCTION("networkingPrivate.requestDisconnect", |
| + NETWORKINGPRIVATE_REQUESTDISCONNECT); |
| + |
| + protected: |
| + virtual ~NetworkingPrivateRequestDisconnectFunction(); |
| + |
| + // AsyncExtensionFunction overrides. |
| + virtual bool RunImpl() OVERRIDE; |
| + |
| + private: |
| + // Called when the request to disconnect succeeds. Doesn't mean that the |
| + // disconnect itself succeeded, just that the request did. |
| + void DisconnectRequestSuccess(); |
| + |
| + void DisconnectRequestFailed(const std::string& errorName, |
| + const std::string& errorMessage); |
| + |
| + DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateRequestDisconnectFunction); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_API_H_ |