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

Unified Diff: chrome/browser/extensions/extension_webproxy_private_api.cc

Issue 6683060: Private API for extensions like ssh-client that need access to TCP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: m Created 9 years, 8 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
Index: chrome/browser/extensions/extension_webproxy_private_api.cc
diff --git a/chrome/browser/extensions/extension_webproxy_private_api.cc b/chrome/browser/extensions/extension_webproxy_private_api.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2500849f33b02b767b0702a325db95c3e07c7952
--- /dev/null
+++ b/chrome/browser/extensions/extension_webproxy_private_api.cc
@@ -0,0 +1,40 @@
+// Copyright (c) 2011 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.
+
+#include "chrome/browser/extensions/extension_webproxy_private_api.h"
+
+#include "base/logging.h"
+#include "base/values.h"
+#include "base/string_number_conversions.h"
+#include "chrome/browser/internal_auth.h"
+
+namespace {
+
+// Access restrictions.
+bool CheckCredentials(
Aaron Boodman 2011/04/10 00:04:43 I think you should just remove this and add it bac
Denis Lagno 2011/05/13 22:02:53 Placed some real content here
+ const std::string& extension_id, const std::string& hostname, int port) {
+ return true;
+}
+
+} // namespace
+
+bool WebproxyGetTokenFunction::RunImpl() {
+ std::string hostname;
Aaron Boodman 2011/04/10 00:04:43 I think it would be good to add a CHECK(extension_
Denis Lagno 2011/05/13 22:02:53 Done.
+ EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &hostname));
+ int port = -1;
+ EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(1, &port));
+ const std::string &id = extension_id();
+
+ if (CheckCredentials(id, hostname, port)) {
+ std::map<std::string, std::string> map;
+ map["Hostname"] = hostname;
+ map["Port"] = base::IntToString(port);
+ map["ExtensionId"] = id;
+ StringValue* token = Value::CreateStringValue(
+ browser::InternalAuthGeneration::GenerateToken("Webproxy", map));
+ result_.reset(token);
+ }
+ return true;
+}
+

Powered by Google App Engine
This is Rietveld 408576698