Chromium Code Reviews| 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/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 // Treat CDM invocations like JavaScript. | 238 // Treat CDM invocations like JavaScript. |
| 239 if (plugin.name == ASCIIToUTF16(kWidevineCdmDisplayName)) { | 239 if (plugin.name == ASCIIToUTF16(kWidevineCdmDisplayName)) { |
| 240 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); | 240 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); |
| 241 return true; | 241 return true; |
| 242 } | 242 } |
| 243 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) | 243 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) |
| 244 | 244 |
| 245 return false; | 245 return false; |
| 246 } | 246 } |
| 247 | 247 |
| 248 void IsGuestViewApiAvailableToScriptContext( | |
| 249 bool* api_is_available, extensions::ScriptContext* context) { | |
| 250 if (context->GetAvailability("appViewInternal").is_available() || | |
| 251 context->GetAvailability("extensionOptionsInternal").is_available() || | |
| 252 context->GetAvailability("guestViewInternal").is_available()) { | |
|
not at google - send to devlin
2014/08/08 14:08:15
why is just the guestViewInternal check not enough
Fady Samuel
2014/08/08 14:12:13
I think it is enough.
| |
| 253 *api_is_available = true; | |
| 254 } | |
| 255 } | |
| 256 | |
| 248 } // namespace | 257 } // namespace |
| 249 | 258 |
| 250 ChromeContentRendererClient::ChromeContentRendererClient() { | 259 ChromeContentRendererClient::ChromeContentRendererClient() { |
| 251 g_current_client = this; | 260 g_current_client = this; |
| 252 | 261 |
| 253 extensions::ExtensionsClient::Set( | 262 extensions::ExtensionsClient::Set( |
| 254 extensions::ChromeExtensionsClient::GetInstance()); | 263 extensions::ChromeExtensionsClient::GetInstance()); |
| 255 extensions::ExtensionsRendererClient::Set( | 264 extensions::ExtensionsRendererClient::Set( |
| 256 ChromeExtensionsRendererClient::GetInstance()); | 265 ChromeExtensionsRendererClient::GetInstance()); |
| 257 #if defined(ENABLE_PLUGINS) | 266 #if defined(ENABLE_PLUGINS) |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 513 return extension_dispatcher_->extensions()->GetByID(extension_id); | 522 return extension_dispatcher_->extensions()->GetByID(extension_id); |
| 514 } | 523 } |
| 515 | 524 |
| 516 bool ChromeContentRendererClient::OverrideCreatePlugin( | 525 bool ChromeContentRendererClient::OverrideCreatePlugin( |
| 517 content::RenderFrame* render_frame, | 526 content::RenderFrame* render_frame, |
| 518 WebLocalFrame* frame, | 527 WebLocalFrame* frame, |
| 519 const WebPluginParams& params, | 528 const WebPluginParams& params, |
| 520 WebPlugin** plugin) { | 529 WebPlugin** plugin) { |
| 521 std::string orig_mime_type = params.mimeType.utf8(); | 530 std::string orig_mime_type = params.mimeType.utf8(); |
| 522 if (orig_mime_type == content::kBrowserPluginMimeType) { | 531 if (orig_mime_type == content::kBrowserPluginMimeType) { |
| 523 WebDocument document = frame->document(); | 532 bool guest_view_api_available = false; |
| 524 const Extension* extension = | 533 extension_dispatcher_->script_context_set().ForEach( |
| 525 GetExtensionByOrigin(document.securityOrigin()); | 534 render_frame->GetRenderView(), |
| 526 if (extension) { | 535 base::Bind(&IsGuestViewApiAvailableToScriptContext, |
| 527 const extensions::APIPermission::ID perms[] = { | 536 &guest_view_api_available)); |
| 528 extensions::APIPermission::kAppView, | 537 if (guest_view_api_available) |
| 529 extensions::APIPermission::kEmbeddedExtensionOptions, | 538 return false; |
| 530 extensions::APIPermission::kWebView, | |
| 531 }; | |
| 532 for (size_t i = 0; i < arraysize(perms); ++i) { | |
| 533 if (extension->permissions_data()->HasAPIPermission(perms[i])) | |
| 534 return false; | |
| 535 } | |
| 536 } | |
| 537 } | 539 } |
| 538 | 540 |
| 539 ChromeViewHostMsg_GetPluginInfo_Output output; | 541 ChromeViewHostMsg_GetPluginInfo_Output output; |
| 540 #if defined(ENABLE_PLUGINS) | 542 #if defined(ENABLE_PLUGINS) |
| 541 render_frame->Send(new ChromeViewHostMsg_GetPluginInfo( | 543 render_frame->Send(new ChromeViewHostMsg_GetPluginInfo( |
| 542 render_frame->GetRoutingID(), GURL(params.url), | 544 render_frame->GetRoutingID(), GURL(params.url), |
| 543 frame->top()->document().url(), orig_mime_type, &output)); | 545 frame->top()->document().url(), orig_mime_type, &output)); |
| 544 | 546 |
| 545 if (output.plugin.type == content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN) | 547 if (output.plugin.type == content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN) |
| 546 return false; | 548 return false; |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1501 | 1503 |
| 1502 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_video_decode_origins_)) | 1504 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_video_decode_origins_)) |
| 1503 return true; | 1505 return true; |
| 1504 | 1506 |
| 1505 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 1507 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
| 1506 return channel <= chrome::VersionInfo::CHANNEL_DEV; | 1508 return channel <= chrome::VersionInfo::CHANNEL_DEV; |
| 1507 #else | 1509 #else |
| 1508 return false; | 1510 return false; |
| 1509 #endif | 1511 #endif |
| 1510 } | 1512 } |
| OLD | NEW |