OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // Treat CDM invocations like JavaScript. | 201 // Treat CDM invocations like JavaScript. |
202 if (plugin.name == ASCIIToUTF16(kWidevineCdmDisplayName)) { | 202 if (plugin.name == ASCIIToUTF16(kWidevineCdmDisplayName)) { |
203 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); | 203 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); |
204 return true; | 204 return true; |
205 } | 205 } |
206 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) | 206 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) |
207 | 207 |
208 return false; | 208 return false; |
209 } | 209 } |
210 | 210 |
211 #if defined(ENABLE_PLUGINS) | |
212 const char* kPredefinedAllowedFileHandleOrigins[] = { | |
213 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/234789 | |
214 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/234789 | |
215 }; | |
216 #endif | |
217 | |
218 } // namespace | 211 } // namespace |
219 | 212 |
220 namespace chrome { | 213 namespace chrome { |
221 | 214 |
222 ChromeContentRendererClient::ChromeContentRendererClient() { | 215 ChromeContentRendererClient::ChromeContentRendererClient() { |
223 g_current_client = this; | 216 g_current_client = this; |
224 | |
225 #if defined(ENABLE_PLUGINS) | |
226 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) | |
227 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); | |
228 #endif | |
229 } | 217 } |
230 | 218 |
231 ChromeContentRendererClient::~ChromeContentRendererClient() { | 219 ChromeContentRendererClient::~ChromeContentRendererClient() { |
232 g_current_client = NULL; | 220 g_current_client = NULL; |
233 } | 221 } |
234 | 222 |
235 void ChromeContentRendererClient::RenderThreadStarted() { | 223 void ChromeContentRendererClient::RenderThreadStarted() { |
236 RenderThread* thread = RenderThread::Get(); | 224 RenderThread* thread = RenderThread::Get(); |
237 | 225 |
238 chrome_observer_.reset(new ChromeRenderProcessObserver(this)); | 226 chrome_observer_.reset(new ChromeRenderProcessObserver(this)); |
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 } | 1284 } |
1297 | 1285 |
1298 bool ChromeContentRendererClient::IsExternalPepperPlugin( | 1286 bool ChromeContentRendererClient::IsExternalPepperPlugin( |
1299 const std::string& module_name) { | 1287 const std::string& module_name) { |
1300 // TODO(bbudge) remove this when the trusted NaCl plugin has been removed. | 1288 // TODO(bbudge) remove this when the trusted NaCl plugin has been removed. |
1301 // We must defer certain plugin events for NaCl instances since we switch | 1289 // We must defer certain plugin events for NaCl instances since we switch |
1302 // from the in-process to the out-of-process proxy after instantiating them. | 1290 // from the in-process to the out-of-process proxy after instantiating them. |
1303 return module_name == "Native Client"; | 1291 return module_name == "Native Client"; |
1304 } | 1292 } |
1305 | 1293 |
1306 bool ChromeContentRendererClient::IsPluginAllowedToCallRequestOSFileHandle( | |
1307 WebKit::WebPluginContainer* container) { | |
1308 #if defined(ENABLE_PLUGINS) | |
1309 if (!container) | |
1310 return false; | |
1311 GURL url = container->element().document().baseURL(); | |
1312 const ExtensionSet* extension_set = extension_dispatcher_->extensions(); | |
1313 | |
1314 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, | |
1315 allowed_file_handle_origins_) || | |
1316 IsHostAllowedByCommandLine(url, extension_set, | |
1317 switches::kAllowNaClFileHandleAPI); | |
1318 #else | |
1319 return false; | |
1320 #endif | |
1321 } | |
1322 | |
1323 WebKit::WebSpeechSynthesizer* | 1294 WebKit::WebSpeechSynthesizer* |
1324 ChromeContentRendererClient::OverrideSpeechSynthesizer( | 1295 ChromeContentRendererClient::OverrideSpeechSynthesizer( |
1325 WebKit::WebSpeechSynthesizerClient* client) { | 1296 WebKit::WebSpeechSynthesizerClient* client) { |
1326 return new TtsDispatcher(client); | 1297 return new TtsDispatcher(client); |
1327 } | 1298 } |
1328 | 1299 |
1329 bool ChromeContentRendererClient::AllowBrowserPlugin( | 1300 bool ChromeContentRendererClient::AllowBrowserPlugin( |
1330 WebKit::WebPluginContainer* container) { | 1301 WebKit::WebPluginContainer* container) { |
1331 if (CommandLine::ForCurrentProcess()->HasSwitch( | 1302 if (CommandLine::ForCurrentProcess()->HasSwitch( |
1332 switches::kEnableBrowserPluginForAllViewTypes)) | 1303 switches::kEnableBrowserPluginForAllViewTypes)) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1387 // SiteIsolationPolicy is off by default. We would like to activate cross-site | 1358 // SiteIsolationPolicy is off by default. We would like to activate cross-site |
1388 // document blocking (for UMA data collection) for normal renderer processes | 1359 // document blocking (for UMA data collection) for normal renderer processes |
1389 // running a normal web page from the Internet. We only turn on | 1360 // running a normal web page from the Internet. We only turn on |
1390 // SiteIsolationPolicy for a renderer process that does not have the extension | 1361 // SiteIsolationPolicy for a renderer process that does not have the extension |
1391 // flag on. | 1362 // flag on. |
1392 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1363 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
1393 return !command_line->HasSwitch(switches::kExtensionProcess); | 1364 return !command_line->HasSwitch(switches::kExtensionProcess); |
1394 } | 1365 } |
1395 | 1366 |
1396 } // namespace chrome | 1367 } // namespace chrome |
OLD | NEW |