| 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..1ef99c9af18d354cfac28651fa84e99f48b78d6c
|
| --- /dev/null
|
| +++ b/chrome/browser/chromeos/extensions/networking_private_api.h
|
| @@ -0,0 +1,121 @@
|
| +// 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;
|
| +
|
| + // Receives the result of a call to GetProperties on the Shill Manager API.
|
| + void ManagerPropertiesCallback(const std::string& network_type,
|
| + chromeos::DBusMethodCallStatus call_status,
|
| + const base::DictionaryValue& result);
|
| +
|
| + // Receives the result of a call to GetProperties on the Shill Service API.
|
| + 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);
|
| + // Gets called when all the results are in.
|
| + void SendResultCallback(scoped_ptr<base::ListValue> result_list);
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetVisibleNetworksFunction);
|
| +};
|
| +
|
| +// Implements the chrome.networkingPrivate.startConnect method.
|
| +class NetworkingPrivateStartConnectFunction : public AsyncExtensionFunction {
|
| + public:
|
| + NetworkingPrivateStartConnectFunction() {}
|
| + DECLARE_EXTENSION_FUNCTION("networkingPrivate.startConnect",
|
| + NETWORKINGPRIVATE_STARTCONNECT);
|
| +
|
| + protected:
|
| + virtual ~NetworkingPrivateStartConnectFunction();
|
| +
|
| + // 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 ConnectionStartSuccess();
|
| +
|
| + void ConnectionStartFailed(const std::string& errorName,
|
| + const std::string& errorMessage);
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartConnectFunction);
|
| +};
|
| +
|
| +// Implements the chrome.networkingPrivate.startDisconnect method.
|
| +class NetworkingPrivateStartDisconnectFunction
|
| + : public AsyncExtensionFunction {
|
| + public:
|
| + NetworkingPrivateStartDisconnectFunction() {}
|
| + DECLARE_EXTENSION_FUNCTION("networkingPrivate.startDisconnect",
|
| + NETWORKINGPRIVATE_STARTDISCONNECT);
|
| +
|
| + protected:
|
| + virtual ~NetworkingPrivateStartDisconnectFunction();
|
| +
|
| + // 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 DisconnectionStartSuccess();
|
| +
|
| + void DisconnectionStartFailed(const std::string& errorName,
|
| + const std::string& errorMessage);
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartDisconnectFunction);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_API_H_
|
|
|