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 | |
219 } // namespace | 212 } // namespace |
220 | 213 |
221 ChromeContentRendererClient::ChromeContentRendererClient() { | 214 ChromeContentRendererClient::ChromeContentRendererClient() { |
222 g_current_client = this; | 215 g_current_client = this; |
223 | |
224 #if defined(ENABLE_PLUGINS) | |
225 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) | |
226 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); | |
227 #endif | |
228 } | 216 } |
229 | 217 |
230 ChromeContentRendererClient::~ChromeContentRendererClient() { | 218 ChromeContentRendererClient::~ChromeContentRendererClient() { |
231 g_current_client = NULL; | 219 g_current_client = NULL; |
232 } | 220 } |
233 | 221 |
234 void ChromeContentRendererClient::RenderThreadStarted() { | 222 void ChromeContentRendererClient::RenderThreadStarted() { |
235 RenderThread* thread = RenderThread::Get(); | 223 RenderThread* thread = RenderThread::Get(); |
236 | 224 |
237 chrome_observer_.reset(new ChromeRenderProcessObserver(this)); | 225 chrome_observer_.reset(new ChromeRenderProcessObserver(this)); |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 } | 1285 } |
1298 | 1286 |
1299 bool ChromeContentRendererClient::IsExternalPepperPlugin( | 1287 bool ChromeContentRendererClient::IsExternalPepperPlugin( |
1300 const std::string& module_name) { | 1288 const std::string& module_name) { |
1301 // TODO(bbudge) remove this when the trusted NaCl plugin has been removed. | 1289 // TODO(bbudge) remove this when the trusted NaCl plugin has been removed. |
1302 // We must defer certain plugin events for NaCl instances since we switch | 1290 // We must defer certain plugin events for NaCl instances since we switch |
1303 // from the in-process to the out-of-process proxy after instantiating them. | 1291 // from the in-process to the out-of-process proxy after instantiating them. |
1304 return module_name == "Native Client"; | 1292 return module_name == "Native Client"; |
1305 } | 1293 } |
1306 | 1294 |
1307 bool ChromeContentRendererClient::IsPluginAllowedToCallRequestOSFileHandle( | |
1308 blink::WebPluginContainer* container) { | |
1309 #if defined(ENABLE_PLUGINS) | |
1310 if (!container) | |
1311 return false; | |
1312 GURL url = container->element().document().baseURL(); | |
1313 const ExtensionSet* extension_set = extension_dispatcher_->extensions(); | |
1314 | |
1315 if (chrome::IsExtensionOrSharedModuleWhitelisted( | |
1316 url, extension_set, allowed_file_handle_origins_) || | |
1317 chrome::IsHostAllowedByCommandLine( | |
1318 url, extension_set, switches::kAllowNaClFileHandleAPI)) { | |
1319 return true; | |
1320 } | |
1321 #endif | |
1322 return false; | |
1323 } | |
1324 | |
1325 blink::WebSpeechSynthesizer* | 1295 blink::WebSpeechSynthesizer* |
1326 ChromeContentRendererClient::OverrideSpeechSynthesizer( | 1296 ChromeContentRendererClient::OverrideSpeechSynthesizer( |
1327 blink::WebSpeechSynthesizerClient* client) { | 1297 blink::WebSpeechSynthesizerClient* client) { |
1328 return new TtsDispatcher(client); | 1298 return new TtsDispatcher(client); |
1329 } | 1299 } |
1330 | 1300 |
1331 bool ChromeContentRendererClient::AllowBrowserPlugin( | 1301 bool ChromeContentRendererClient::AllowBrowserPlugin( |
1332 blink::WebPluginContainer* container) { | 1302 blink::WebPluginContainer* container) { |
1333 if (CommandLine::ForCurrentProcess()->HasSwitch( | 1303 if (CommandLine::ForCurrentProcess()->HasSwitch( |
1334 switches::kEnableBrowserPluginForAllViewTypes)) | 1304 switches::kEnableBrowserPluginForAllViewTypes)) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1394 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1364 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
1395 return !command_line->HasSwitch(switches::kExtensionProcess); | 1365 return !command_line->HasSwitch(switches::kExtensionProcess); |
1396 } | 1366 } |
1397 | 1367 |
1398 blink::WebWorkerPermissionClientProxy* | 1368 blink::WebWorkerPermissionClientProxy* |
1399 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( | 1369 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( |
1400 content::RenderView* render_view, | 1370 content::RenderView* render_view, |
1401 blink::WebFrame* frame) { | 1371 blink::WebFrame* frame) { |
1402 return new WorkerPermissionClientProxy(render_view, frame); | 1372 return new WorkerPermissionClientProxy(render_view, frame); |
1403 } | 1373 } |
OLD | NEW |