Chromium Code Reviews| 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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 479 void RenderFrameMessageFilter::GetPluginsCallback( | 479 void RenderFrameMessageFilter::GetPluginsCallback( |
| 480 IPC::Message* reply_msg, | 480 IPC::Message* reply_msg, |
| 481 const url::Origin& main_frame_origin, | 481 const url::Origin& main_frame_origin, |
| 482 const std::vector<WebPluginInfo>& all_plugins) { | 482 const std::vector<WebPluginInfo>& all_plugins) { |
| 483 // Filter the plugin list. | 483 // Filter the plugin list. |
| 484 PluginServiceFilter* filter = PluginServiceImpl::GetInstance()->GetFilter(); | 484 PluginServiceFilter* filter = PluginServiceImpl::GetInstance()->GetFilter(); |
| 485 std::vector<WebPluginInfo> plugins; | 485 std::vector<WebPluginInfo> plugins; |
| 486 | 486 |
| 487 int child_process_id = -1; | 487 int child_process_id = -1; |
| 488 int routing_id = MSG_ROUTING_NONE; | 488 int routing_id = MSG_ROUTING_NONE; |
| 489 GURL policy_url = | 489 GURL plugin_content_url = |
| 490 main_frame_origin.unique() ? GURL() : GURL(main_frame_origin.Serialize()); | 490 main_frame_origin.unique() ? GURL() : GURL(main_frame_origin.Serialize()); |
| 491 // In this loop, copy the WebPluginInfo (and do not use a reference) because | 491 // In this loop, copy the WebPluginInfo (and do not use a reference) because |
| 492 // the filter might mutate it. | 492 // the filter might mutate it. |
| 493 for (WebPluginInfo plugin : all_plugins) { | 493 for (WebPluginInfo plugin : all_plugins) { |
| 494 // TODO(crbug.com/621724): Pass an url::Origin instead of a GURL. | 494 // TODO(crbug.com/621724): Pass an url::Origin instead of a GURL. |
| 495 if (!filter || | 495 if (!filter || |
| 496 filter->IsPluginAvailable(child_process_id, routing_id, | 496 filter->IsPluginAvailable(child_process_id, routing_id, |
| 497 resource_context_, policy_url, policy_url, | 497 resource_context_, plugin_content_url, |
| 498 &plugin)) { | 498 main_frame_origin, &plugin)) { |
| 499 plugins.push_back(plugin); | 499 plugins.push_back(plugin); |
| 500 } | 500 } |
| 501 } | 501 } |
| 502 | 502 |
| 503 FrameHostMsg_GetPlugins::WriteReplyParams(reply_msg, plugins); | 503 FrameHostMsg_GetPlugins::WriteReplyParams(reply_msg, plugins); |
| 504 Send(reply_msg); | 504 Send(reply_msg); |
| 505 } | 505 } |
| 506 | 506 |
| 507 void RenderFrameMessageFilter::OnGetPluginInfo( | 507 void RenderFrameMessageFilter::OnGetPluginInfo(int render_frame_id, |
| 508 int render_frame_id, | 508 const GURL& url, |
| 509 const GURL& url, | 509 const url::Origin& page_url, |
|
nasko
2016/09/30 20:38:48
Not on URL.
tommycli
2016/09/30 21:20:42
Done.
| |
| 510 const GURL& page_url, | 510 const std::string& mime_type, |
| 511 const std::string& mime_type, | 511 bool* found, |
| 512 bool* found, | 512 WebPluginInfo* info, |
| 513 WebPluginInfo* info, | 513 std::string* actual_mime_type) { |
| 514 std::string* actual_mime_type) { | |
| 515 bool allow_wildcard = true; | 514 bool allow_wildcard = true; |
| 516 *found = plugin_service_->GetPluginInfo( | 515 *found = plugin_service_->GetPluginInfo( |
| 517 render_process_id_, render_frame_id, resource_context_, | 516 render_process_id_, render_frame_id, resource_context_, |
| 518 url, page_url, mime_type, allow_wildcard, | 517 url, page_url, mime_type, allow_wildcard, |
| 519 nullptr, info, actual_mime_type); | 518 nullptr, info, actual_mime_type); |
| 520 } | 519 } |
| 521 | 520 |
| 522 void RenderFrameMessageFilter::OnOpenChannelToPepperPlugin( | 521 void RenderFrameMessageFilter::OnOpenChannelToPepperPlugin( |
| 523 const base::FilePath& path, | 522 const base::FilePath& path, |
| 524 IPC::Message* reply_msg) { | 523 IPC::Message* reply_msg) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 599 net::URLRequestContext* context = | 598 net::URLRequestContext* context = |
| 600 GetContentClient()->browser()->OverrideRequestContextForURL( | 599 GetContentClient()->browser()->OverrideRequestContextForURL( |
| 601 url, resource_context_); | 600 url, resource_context_); |
| 602 if (!context) | 601 if (!context) |
| 603 context = request_context_->GetURLRequestContext(); | 602 context = request_context_->GetURLRequestContext(); |
| 604 | 603 |
| 605 return context; | 604 return context; |
| 606 } | 605 } |
| 607 | 606 |
| 608 } // namespace content | 607 } // namespace content |
| OLD | NEW |