| 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 #include "base/debug/stack_trace.h" |
| 6 | 7 |
| 7 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 8 #include "base/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 10 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
| 11 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 12 #include "base/metrics/user_metrics_action.h" | 13 #include "base/metrics/user_metrics_action.h" |
| 13 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 return NULL; | 489 return NULL; |
| 489 | 490 |
| 490 const std::string extension_id = origin.host().utf8().data(); | 491 const std::string extension_id = origin.host().utf8().data(); |
| 491 return extension_dispatcher_->extensions()->GetByID(extension_id); | 492 return extension_dispatcher_->extensions()->GetByID(extension_id); |
| 492 } | 493 } |
| 493 | 494 |
| 494 bool ChromeContentRendererClient::OverrideCreatePlugin( | 495 bool ChromeContentRendererClient::OverrideCreatePlugin( |
| 495 content::RenderFrame* render_frame, | 496 content::RenderFrame* render_frame, |
| 496 WebLocalFrame* frame, | 497 WebLocalFrame* frame, |
| 497 const WebPluginParams& params, | 498 const WebPluginParams& params, |
| 499 int* instance_id, |
| 498 WebPlugin** plugin) { | 500 WebPlugin** plugin) { |
| 501 *instance_id = -1; // kInstanceIDNone. |
| 499 std::string orig_mime_type = params.mimeType.utf8(); | 502 std::string orig_mime_type = params.mimeType.utf8(); |
| 500 if (orig_mime_type == content::kBrowserPluginMimeType) { | 503 if (orig_mime_type == content::kBrowserPluginMimeType) { |
| 501 WebDocument document = frame->document(); | 504 WebDocument document = frame->document(); |
| 502 const Extension* extension = | 505 const Extension* extension = |
| 503 GetExtensionByOrigin(document.securityOrigin()); | 506 GetExtensionByOrigin(document.securityOrigin()); |
| 504 if (extension) { | 507 if (extension) { |
| 505 const extensions::APIPermission::ID perms[] = { | 508 const extensions::APIPermission::ID perms[] = { |
| 506 extensions::APIPermission::kAppView, | 509 extensions::APIPermission::kAppView, |
| 507 extensions::APIPermission::kWebView, | 510 extensions::APIPermission::kWebView, |
| 508 }; | 511 }; |
| 509 for (size_t i = 0; i < arraysize(perms); ++i) { | 512 for (size_t i = 0; i < arraysize(perms); ++i) { |
| 510 if (extension->permissions_data()->HasAPIPermission(perms[i])) | 513 if (extension->permissions_data()->HasAPIPermission(perms[i])) |
| 511 return false; | 514 return false; |
| 512 } | 515 } |
| 513 } | 516 } |
| 514 } | 517 } |
| 515 | 518 |
| 516 ChromeViewHostMsg_GetPluginInfo_Output output; | 519 ChromeViewHostMsg_GetPluginInfo_Output output; |
| 517 #if defined(ENABLE_PLUGINS) | 520 #if defined(ENABLE_PLUGINS) |
| 518 render_frame->Send(new ChromeViewHostMsg_GetPluginInfo( | 521 render_frame->Send(new ChromeViewHostMsg_GetPluginInfo( |
| 519 render_frame->GetRoutingID(), GURL(params.url), | 522 render_frame->GetRoutingID(), GURL(params.url), |
| 520 frame->top()->document().url(), orig_mime_type, &output)); | 523 frame->top()->document().url(), orig_mime_type, &output)); |
| 524 printf("PLUGIN_TYPE_BROWSER_PLUGIN: %d\n", |
| 525 content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN); |
| 521 | 526 |
| 522 if (output.plugin.type == content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN) | 527 // This would result in double GetPluginInfo, once from here and one more time |
| 528 // from content/. |
| 529 if (output.plugin.type == content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN)
{ |
| 530 *instance_id = output.instance_id; |
| 523 return false; | 531 return false; |
| 532 } |
| 524 #else | 533 #else |
| 525 output.status.value = ChromeViewHostMsg_GetPluginInfo_Status::kNotFound; | 534 output.status.value = ChromeViewHostMsg_GetPluginInfo_Status::kNotFound; |
| 526 #endif | 535 #endif |
| 527 *plugin = CreatePlugin(render_frame, frame, params, output); | 536 *plugin = CreatePlugin(render_frame, frame, params, output); |
| 528 return true; | 537 return true; |
| 529 } | 538 } |
| 530 | 539 |
| 531 WebPlugin* ChromeContentRendererClient::CreatePluginReplacement( | 540 WebPlugin* ChromeContentRendererClient::CreatePluginReplacement( |
| 532 content::RenderFrame* render_frame, | 541 content::RenderFrame* render_frame, |
| 533 const base::FilePath& plugin_path) { | 542 const base::FilePath& plugin_path) { |
| (...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1437 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 1429 return !command_line->HasSwitch(extensions::switches::kExtensionProcess); | 1438 return !command_line->HasSwitch(extensions::switches::kExtensionProcess); |
| 1430 } | 1439 } |
| 1431 | 1440 |
| 1432 blink::WebWorkerPermissionClientProxy* | 1441 blink::WebWorkerPermissionClientProxy* |
| 1433 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( | 1442 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( |
| 1434 content::RenderFrame* render_frame, | 1443 content::RenderFrame* render_frame, |
| 1435 blink::WebFrame* frame) { | 1444 blink::WebFrame* frame) { |
| 1436 return new WorkerPermissionClientProxy(render_frame, frame); | 1445 return new WorkerPermissionClientProxy(render_frame, frame); |
| 1437 } | 1446 } |
| OLD | NEW |