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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 #include "chrome/browser/extensions/extension_webproxy_private_api.h"
6
7 #include "base/logging.h"
8 #include "base/values.h"
9 #include "base/string_number_conversions.h"
10 #include "chrome/browser/internal_auth.h"
11
12 namespace {
13
14 // Access restrictions.
15 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
16 const std::string& extension_id, const std::string& hostname, int port) {
17 return true;
18 }
19
20 } // namespace
21
22 bool WebproxyGetTokenFunction::RunImpl() {
23 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.
24 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &hostname));
25 int port = -1;
26 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(1, &port));
27 const std::string &id = extension_id();
28
29 if (CheckCredentials(id, hostname, port)) {
30 std::map<std::string, std::string> map;
31 map["Hostname"] = hostname;
32 map["Port"] = base::IntToString(port);
33 map["ExtensionId"] = id;
34 StringValue* token = Value::CreateStringValue(
35 browser::InternalAuthGeneration::GenerateToken("Webproxy", map));
36 result_.reset(token);
37 }
38 return true;
39 }
40
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698