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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // Treat CDM invocations like JavaScript. | 202 // Treat CDM invocations like JavaScript. |
203 if (plugin.name == ASCIIToUTF16(kWidevineCdmDisplayName)) { | 203 if (plugin.name == ASCIIToUTF16(kWidevineCdmDisplayName)) { |
204 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); | 204 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); |
205 return true; | 205 return true; |
206 } | 206 } |
207 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) | 207 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) |
208 | 208 |
209 return false; | 209 return false; |
210 } | 210 } |
211 | 211 |
| 212 #if defined(ENABLE_PLUGINS) |
| 213 const char* kPredefinedAllowedFileHandleOrigins[] = { |
| 214 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/234789 |
| 215 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/234789 |
| 216 }; |
| 217 #endif |
| 218 |
212 } // namespace | 219 } // namespace |
213 | 220 |
214 namespace chrome { | 221 namespace chrome { |
215 | 222 |
216 ChromeContentRendererClient::ChromeContentRendererClient() { | 223 ChromeContentRendererClient::ChromeContentRendererClient() { |
217 g_current_client = this; | 224 g_current_client = this; |
| 225 |
| 226 #if defined(ENABLE_PLUGINS) |
| 227 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) |
| 228 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); |
| 229 #endif |
218 } | 230 } |
219 | 231 |
220 ChromeContentRendererClient::~ChromeContentRendererClient() { | 232 ChromeContentRendererClient::~ChromeContentRendererClient() { |
221 g_current_client = NULL; | 233 g_current_client = NULL; |
222 } | 234 } |
223 | 235 |
224 void ChromeContentRendererClient::RenderThreadStarted() { | 236 void ChromeContentRendererClient::RenderThreadStarted() { |
225 RenderThread* thread = RenderThread::Get(); | 237 RenderThread* thread = RenderThread::Get(); |
226 | 238 |
227 chrome_observer_.reset(new ChromeRenderProcessObserver(this)); | 239 chrome_observer_.reset(new ChromeRenderProcessObserver(this)); |
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 } | 1300 } |
1289 | 1301 |
1290 bool ChromeContentRendererClient::IsExternalPepperPlugin( | 1302 bool ChromeContentRendererClient::IsExternalPepperPlugin( |
1291 const std::string& module_name) { | 1303 const std::string& module_name) { |
1292 // TODO(bbudge) remove this when the trusted NaCl plugin has been removed. | 1304 // TODO(bbudge) remove this when the trusted NaCl plugin has been removed. |
1293 // We must defer certain plugin events for NaCl instances since we switch | 1305 // We must defer certain plugin events for NaCl instances since we switch |
1294 // from the in-process to the out-of-process proxy after instantiating them. | 1306 // from the in-process to the out-of-process proxy after instantiating them. |
1295 return module_name == "Native Client"; | 1307 return module_name == "Native Client"; |
1296 } | 1308 } |
1297 | 1309 |
| 1310 bool ChromeContentRendererClient::IsPluginAllowedToCallRequestOSFileHandle( |
| 1311 WebKit::WebPluginContainer* container) { |
| 1312 #if defined(ENABLE_PLUGINS) |
| 1313 if (!container) |
| 1314 return false; |
| 1315 GURL url = container->element().document().baseURL(); |
| 1316 const ExtensionSet* extension_set = extension_dispatcher_->extensions(); |
| 1317 |
| 1318 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, |
| 1319 allowed_file_handle_origins_) || |
| 1320 IsHostAllowedByCommandLine(url, extension_set, |
| 1321 switches::kAllowNaClFileHandleAPI); |
| 1322 #else |
| 1323 return false; |
| 1324 #endif |
| 1325 } |
| 1326 |
1298 WebKit::WebSpeechSynthesizer* | 1327 WebKit::WebSpeechSynthesizer* |
1299 ChromeContentRendererClient::OverrideSpeechSynthesizer( | 1328 ChromeContentRendererClient::OverrideSpeechSynthesizer( |
1300 WebKit::WebSpeechSynthesizerClient* client) { | 1329 WebKit::WebSpeechSynthesizerClient* client) { |
1301 return new TtsDispatcher(client); | 1330 return new TtsDispatcher(client); |
1302 } | 1331 } |
1303 | 1332 |
1304 bool ChromeContentRendererClient::AllowBrowserPlugin( | 1333 bool ChromeContentRendererClient::AllowBrowserPlugin( |
1305 WebKit::WebPluginContainer* container) { | 1334 WebKit::WebPluginContainer* container) { |
1306 if (CommandLine::ForCurrentProcess()->HasSwitch( | 1335 if (CommandLine::ForCurrentProcess()->HasSwitch( |
1307 switches::kEnableBrowserPluginForAllViewTypes)) | 1336 switches::kEnableBrowserPluginForAllViewTypes)) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1369 } | 1398 } |
1370 | 1399 |
1371 WebKit::WebWorkerPermissionClientProxy* | 1400 WebKit::WebWorkerPermissionClientProxy* |
1372 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( | 1401 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( |
1373 content::RenderView* render_view, | 1402 content::RenderView* render_view, |
1374 WebKit::WebFrame* frame) { | 1403 WebKit::WebFrame* frame) { |
1375 return new WorkerPermissionClientProxy(render_view, frame); | 1404 return new WorkerPermissionClientProxy(render_view, frame); |
1376 } | 1405 } |
1377 | 1406 |
1378 } // namespace chrome | 1407 } // namespace chrome |
OLD | NEW |