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 = | 495 GURL plugin_content_url = |
nasko
2016/10/05 21:14:31
This is still an origin, even if it is stored as a
tommycli
2016/10/05 21:41:23
Done.
| |
496 main_frame_origin.unique() ? GURL() : GURL(main_frame_origin.Serialize()); | 496 main_frame_origin.unique() ? GURL() : GURL(main_frame_origin.Serialize()); |
nasko
2016/10/05 21:14:31
Let's change that to be main_frame_origin.GetURL()
tommycli
2016/10/05 21:41:22
Done.
| |
497 // In this loop, copy the WebPluginInfo (and do not use a reference) because | 497 // In this loop, copy the WebPluginInfo (and do not use a reference) because |
498 // the filter might mutate it. | 498 // the filter might mutate it. |
499 for (WebPluginInfo plugin : all_plugins) { | 499 for (WebPluginInfo plugin : all_plugins) { |
500 // TODO(crbug.com/621724): Pass an url::Origin instead of a GURL. | 500 // TODO(crbug.com/621724): Pass an url::Origin instead of a GURL. |
501 if (!filter || | 501 if (!filter || |
502 filter->IsPluginAvailable(child_process_id, routing_id, | 502 filter->IsPluginAvailable(child_process_id, routing_id, |
503 resource_context_, policy_url, policy_url, | 503 resource_context_, plugin_content_url, |
504 &plugin)) { | 504 main_frame_origin, &plugin)) { |
505 plugins.push_back(plugin); | 505 plugins.push_back(plugin); |
506 } | 506 } |
507 } | 507 } |
508 | 508 |
509 FrameHostMsg_GetPlugins::WriteReplyParams(reply_msg, plugins); | 509 FrameHostMsg_GetPlugins::WriteReplyParams(reply_msg, plugins); |
510 Send(reply_msg); | 510 Send(reply_msg); |
511 } | 511 } |
512 | 512 |
513 void RenderFrameMessageFilter::OnGetPluginInfo( | 513 void RenderFrameMessageFilter::OnGetPluginInfo( |
514 int render_frame_id, | 514 int render_frame_id, |
515 const GURL& url, | 515 const GURL& url, |
516 const GURL& page_url, | 516 const url::Origin& main_frame_origin, |
517 const std::string& mime_type, | 517 const std::string& mime_type, |
518 bool* found, | 518 bool* found, |
519 WebPluginInfo* info, | 519 WebPluginInfo* info, |
520 std::string* actual_mime_type) { | 520 std::string* actual_mime_type) { |
521 bool allow_wildcard = true; | 521 bool allow_wildcard = true; |
522 *found = plugin_service_->GetPluginInfo( | 522 *found = plugin_service_->GetPluginInfo( |
523 render_process_id_, render_frame_id, resource_context_, | 523 render_process_id_, render_frame_id, resource_context_, url, |
524 url, page_url, mime_type, allow_wildcard, | 524 main_frame_origin, mime_type, allow_wildcard, nullptr, info, |
525 nullptr, info, actual_mime_type); | 525 actual_mime_type); |
526 } | 526 } |
527 | 527 |
528 void RenderFrameMessageFilter::OnOpenChannelToPepperPlugin( | 528 void RenderFrameMessageFilter::OnOpenChannelToPepperPlugin( |
529 const base::FilePath& path, | 529 const base::FilePath& path, |
530 IPC::Message* reply_msg) { | 530 IPC::Message* reply_msg) { |
531 plugin_service_->OpenChannelToPpapiPlugin( | 531 plugin_service_->OpenChannelToPpapiPlugin( |
532 render_process_id_, | 532 render_process_id_, |
533 path, | 533 path, |
534 profile_data_directory_, | 534 profile_data_directory_, |
535 new OpenChannelToPpapiPluginCallback(this, resource_context_, reply_msg)); | 535 new OpenChannelToPpapiPluginCallback(this, resource_context_, reply_msg)); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
605 net::URLRequestContext* context = | 605 net::URLRequestContext* context = |
606 GetContentClient()->browser()->OverrideRequestContextForURL( | 606 GetContentClient()->browser()->OverrideRequestContextForURL( |
607 url, resource_context_); | 607 url, resource_context_); |
608 if (!context) | 608 if (!context) |
609 context = request_context_->GetURLRequestContext(); | 609 context = request_context_->GetURLRequestContext(); |
610 | 610 |
611 return context; | 611 return context; |
612 } | 612 } |
613 | 613 |
614 } // namespace content | 614 } // namespace content |
OLD | NEW |