Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2943)

Unified Diff: chrome/browser/chromeos/extensions/networking_private_api.h

Issue 11975015: This adds a private extension API to use for simple networking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: upload after another merge Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/networking_private_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..df4d567a2c26514a15740d634d545b137649062d
--- /dev/null
+++ b/chrome/browser/chromeos/extensions/networking_private_api.h
@@ -0,0 +1,110 @@
+// 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;
+
+ // Gets called when all the results are in.
+ void SendResultCallback(const std::string& error,
+ scoped_ptr<base::ListValue> result_list);
+
+ private:
+
+ 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& error_name,
+ const std::string& error_message);
+
+ 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& error_name,
+ const std::string& error_message);
+
+ DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartDisconnectFunction);
+};
+
+#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_API_H_
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/networking_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698