OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/frame_host/render_frame_message_filter.h" | 5 #include "content/browser/frame_host/render_frame_message_filter.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 void RenderFrameMessageFilter::GetPluginsCallback( | 485 void RenderFrameMessageFilter::GetPluginsCallback( |
486 IPC::Message* reply_msg, | 486 IPC::Message* reply_msg, |
487 const url::Origin& main_frame_origin, | 487 const url::Origin& main_frame_origin, |
488 const std::vector<WebPluginInfo>& all_plugins) { | 488 const std::vector<WebPluginInfo>& all_plugins) { |
489 // Filter the plugin list. | 489 // Filter the plugin list. |
490 PluginServiceFilter* filter = PluginServiceImpl::GetInstance()->GetFilter(); | 490 PluginServiceFilter* filter = PluginServiceImpl::GetInstance()->GetFilter(); |
491 std::vector<WebPluginInfo> plugins; | 491 std::vector<WebPluginInfo> plugins; |
492 | 492 |
493 int child_process_id = -1; | 493 int child_process_id = -1; |
494 int routing_id = MSG_ROUTING_NONE; | 494 int routing_id = MSG_ROUTING_NONE; |
495 GURL policy_url = | |
496 main_frame_origin.unique() ? GURL() : GURL(main_frame_origin.Serialize()); | |
497 // In this loop, copy the WebPluginInfo (and do not use a reference) because | 495 // In this loop, copy the WebPluginInfo (and do not use a reference) because |
498 // the filter might mutate it. | 496 // the filter might mutate it. |
499 for (WebPluginInfo plugin : all_plugins) { | 497 for (WebPluginInfo plugin : all_plugins) { |
500 // TODO(crbug.com/621724): Pass an url::Origin instead of a GURL. | 498 // TODO(crbug.com/621724): Pass an url::Origin instead of a GURL. |
501 if (!filter || | 499 if (!filter || |
502 filter->IsPluginAvailable(child_process_id, routing_id, | 500 filter->IsPluginAvailable(child_process_id, routing_id, |
503 resource_context_, policy_url, policy_url, | 501 resource_context_, main_frame_origin.GetURL(), |
504 &plugin)) { | 502 main_frame_origin, &plugin)) { |
505 plugins.push_back(plugin); | 503 plugins.push_back(plugin); |
506 } | 504 } |
507 } | 505 } |
508 | 506 |
509 FrameHostMsg_GetPlugins::WriteReplyParams(reply_msg, plugins); | 507 FrameHostMsg_GetPlugins::WriteReplyParams(reply_msg, plugins); |
510 Send(reply_msg); | 508 Send(reply_msg); |
511 } | 509 } |
512 | 510 |
513 void RenderFrameMessageFilter::OnGetPluginInfo( | 511 void RenderFrameMessageFilter::OnGetPluginInfo( |
514 int render_frame_id, | 512 int render_frame_id, |
515 const GURL& url, | 513 const GURL& url, |
516 const GURL& page_url, | 514 const url::Origin& main_frame_origin, |
517 const std::string& mime_type, | 515 const std::string& mime_type, |
518 bool* found, | 516 bool* found, |
519 WebPluginInfo* info, | 517 WebPluginInfo* info, |
520 std::string* actual_mime_type) { | 518 std::string* actual_mime_type) { |
521 bool allow_wildcard = true; | 519 bool allow_wildcard = true; |
522 *found = plugin_service_->GetPluginInfo( | 520 *found = plugin_service_->GetPluginInfo( |
523 render_process_id_, render_frame_id, resource_context_, | 521 render_process_id_, render_frame_id, resource_context_, url, |
524 url, page_url, mime_type, allow_wildcard, | 522 main_frame_origin, mime_type, allow_wildcard, nullptr, info, |
525 nullptr, info, actual_mime_type); | 523 actual_mime_type); |
526 } | 524 } |
527 | 525 |
528 void RenderFrameMessageFilter::OnOpenChannelToPepperPlugin( | 526 void RenderFrameMessageFilter::OnOpenChannelToPepperPlugin( |
529 const base::FilePath& path, | 527 const base::FilePath& path, |
530 IPC::Message* reply_msg) { | 528 IPC::Message* reply_msg) { |
531 plugin_service_->OpenChannelToPpapiPlugin( | 529 plugin_service_->OpenChannelToPpapiPlugin( |
532 render_process_id_, | 530 render_process_id_, |
533 path, | 531 path, |
534 profile_data_directory_, | 532 profile_data_directory_, |
535 new OpenChannelToPpapiPluginCallback(this, resource_context_, reply_msg)); | 533 new OpenChannelToPpapiPluginCallback(this, resource_context_, reply_msg)); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 net::URLRequestContext* context = | 603 net::URLRequestContext* context = |
606 GetContentClient()->browser()->OverrideRequestContextForURL( | 604 GetContentClient()->browser()->OverrideRequestContextForURL( |
607 url, resource_context_); | 605 url, resource_context_); |
608 if (!context) | 606 if (!context) |
609 context = request_context_->GetURLRequestContext(); | 607 context = request_context_->GetURLRequestContext(); |
610 | 608 |
611 return context; | 609 return context; |
612 } | 610 } |
613 | 611 |
614 } // namespace content | 612 } // namespace content |
OLD | NEW |