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

Unified Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 8804006: Reland 8688002: PPB_TCPSocket_Private/PPB_UDPSocket_Private are exposed to Browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed compilation for content_shell_lib Created 9 years 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/renderer/chrome_content_renderer_client.cc
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index 495414a732da96ba15105fe49cf59078812b4e66..066ff43f29f8992b54e6ba1a84f50a2cd4317384 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -10,6 +10,7 @@
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "base/path_service.h"
+#include "base/string_tokenizer.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/common/child_process_logging.h"
@@ -103,6 +104,10 @@ using content::RenderThread;
namespace {
+const char* kPredefinedAllowedSocketOrigins[] = {
+ "okddffdblfhhnmhodogpojmfkjmhinfp" // SSH Client
+};
+
static void AppendParams(const std::vector<string16>& additional_names,
const std::vector<string16>& additional_values,
WebVector<WebString>* existing_names,
@@ -136,6 +141,18 @@ namespace chrome {
ChromeContentRendererClient::ChromeContentRendererClient()
: spellcheck_provider_(NULL) {
+ for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i)
+ allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]);
+
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ std::string allowed_list =
+ command_line.GetSwitchValueASCII(switches::kAllowNaClSocketAPI);
+ if (!allowed_list.empty()) {
+ StringTokenizer t(allowed_list, ",");
+ while (t.GetNext()) {
+ allowed_socket_origins_.insert(t.token());
+ }
+ }
}
ChromeContentRendererClient::~ChromeContentRendererClient() {
@@ -789,4 +806,9 @@ void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories(
factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory);
}
+bool ChromeContentRendererClient::AllowSocketAPI(const GURL& url) {
+ return allowed_socket_origins_.find(url.host()) !=
+ allowed_socket_origins_.end();
+}
+
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698