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

Side by Side 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: extend RenderViewObserver 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/string_tokenizer.h"
13 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
14 #include "base/values.h" 15 #include "base/values.h"
15 #include "chrome/common/child_process_logging.h" 16 #include "chrome/common/child_process_logging.h"
16 #include "chrome/common/chrome_content_client.h" 17 #include "chrome/common/chrome_content_client.h"
17 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
18 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/content_settings_pattern.h" 20 #include "chrome/common/content_settings_pattern.h"
20 #include "chrome/common/external_ipc_fuzzer.h" 21 #include "chrome/common/external_ipc_fuzzer.h"
21 #include "chrome/common/extensions/extension.h" 22 #include "chrome/common/extensions/extension.h"
22 #include "chrome/common/extensions/extension_constants.h" 23 #include "chrome/common/extensions/extension_constants.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 using WebKit::WebURLError; 97 using WebKit::WebURLError;
97 using WebKit::WebURLRequest; 98 using WebKit::WebURLRequest;
98 using WebKit::WebURLResponse; 99 using WebKit::WebURLResponse;
99 using WebKit::WebVector; 100 using WebKit::WebVector;
100 using autofill::AutofillAgent; 101 using autofill::AutofillAgent;
101 using autofill::PasswordAutofillManager; 102 using autofill::PasswordAutofillManager;
102 using content::RenderThread; 103 using content::RenderThread;
103 104
104 namespace { 105 namespace {
105 106
107 const char* kPredefinedAllowedSocketOrigins[] = {
108 "okddffdblfhhnmhodogpojmfkjmhinfp" // SSH Client
109 };
110
106 static void AppendParams(const std::vector<string16>& additional_names, 111 static void AppendParams(const std::vector<string16>& additional_names,
107 const std::vector<string16>& additional_values, 112 const std::vector<string16>& additional_values,
108 WebVector<WebString>* existing_names, 113 WebVector<WebString>* existing_names,
109 WebVector<WebString>* existing_values) { 114 WebVector<WebString>* existing_values) {
110 DCHECK(additional_names.size() == additional_values.size()); 115 DCHECK(additional_names.size() == additional_values.size());
111 DCHECK(existing_names->size() == existing_values->size()); 116 DCHECK(existing_names->size() == existing_values->size());
112 117
113 size_t existing_size = existing_names->size(); 118 size_t existing_size = existing_names->size();
114 size_t total_size = existing_size + additional_names.size(); 119 size_t total_size = existing_size + additional_names.size();
115 120
(...skipping 13 matching lines...) Expand all
129 existing_names->swap(names); 134 existing_names->swap(names);
130 existing_values->swap(values); 135 existing_values->swap(values);
131 } 136 }
132 137
133 } // namespace 138 } // namespace
134 139
135 namespace chrome { 140 namespace chrome {
136 141
137 ChromeContentRendererClient::ChromeContentRendererClient() 142 ChromeContentRendererClient::ChromeContentRendererClient()
138 : spellcheck_provider_(NULL) { 143 : spellcheck_provider_(NULL) {
144 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i)
145 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]);
146
147 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
148 std::string allowed_list =
149 command_line.GetSwitchValueASCII(switches::kAllowNaClSocketAPI);
150 if (!allowed_list.empty()) {
151 StringTokenizer t(allowed_list, ",");
152 while (t.GetNext()) {
153 allowed_socket_origins_.insert(t.token());
154 }
155 }
139 } 156 }
140 157
141 ChromeContentRendererClient::~ChromeContentRendererClient() { 158 ChromeContentRendererClient::~ChromeContentRendererClient() {
142 } 159 }
143 160
144 void ChromeContentRendererClient::RenderThreadStarted() { 161 void ChromeContentRendererClient::RenderThreadStarted() {
145 chrome_observer_.reset(new ChromeRenderProcessObserver(this)); 162 chrome_observer_.reset(new ChromeRenderProcessObserver(this));
146 extension_dispatcher_.reset(new ExtensionDispatcher()); 163 extension_dispatcher_.reset(new ExtensionDispatcher());
147 histogram_snapshots_.reset(new RendererHistogramSnapshots()); 164 histogram_snapshots_.reset(new RendererHistogramSnapshots());
148 net_predictor_.reset(new RendererNetPredictor()); 165 net_predictor_.reset(new RendererNetPredictor());
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 799
783 bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() { 800 bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() {
784 return extension_dispatcher_->IsOtherExtensionWithWebRequestInstalled(); 801 return extension_dispatcher_->IsOtherExtensionWithWebRequestInstalled();
785 } 802 }
786 803
787 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( 804 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories(
788 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { 805 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) {
789 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); 806 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory);
790 } 807 }
791 808
809 bool ChromeContentRendererClient::AllowSocketAPI(const GURL& url) {
810 return allowed_socket_origins_.find(url.host()) !=
811 allowed_socket_origins_.end();
812 }
813
792 } // namespace chrome 814 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698