Index: content/browser/web_contents/web_contents_impl.cc |
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
index 4ce4f972db0f278193541181710e527129cdb364..a8ea6331fba565a73f6171ac2ccab8c4cd914fe7 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -493,6 +493,8 @@ bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, |
IPC_BEGIN_MESSAGE_MAP(WebContentsImpl, message) |
IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung) |
IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed) |
+ IPC_MESSAGE_HANDLER(FrameHostMsg_PluginContentOriginAllowed, |
+ OnPluginContentOriginAllowed) |
IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse, |
OnDomOperationResponse) |
IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeThemeColor, |
@@ -2899,6 +2901,17 @@ void WebContentsImpl::OnPluginCrashed(const base::FilePath& plugin_path, |
PluginCrashed(plugin_path, plugin_pid)); |
} |
+void WebContentsImpl::OnPluginContentOriginAllowed(const GURL& content_origin) { |
+ DCHECK(render_frame_message_source_); |
+ DCHECK(!render_view_message_source_); |
+ |
+ plugin_content_origin_whitelist_[render_frame_message_source_].insert( |
+ content_origin); |
+ |
+ SendToAllFrames(new FrameMsg_UpdatePluginContentOriginWhitelist( |
+ MSG_ROUTING_NONE, GetPluginContentOriginWhitelist())); |
+} |
+ |
void WebContentsImpl::OnDomOperationResponse(const std::string& json_string, |
int automation_id) { |
DomOperationNotificationDetails details(json_string, automation_id); |
@@ -3332,10 +3345,24 @@ void WebContentsImpl::RenderFrameCreated(RenderFrameHost* render_frame_host) { |
observers_, |
RenderFrameCreated(render_frame_host)); |
SetAccessibilityModeOnFrame(accessibility_mode_, render_frame_host); |
+ |
+ if (!plugin_content_origin_whitelist_.empty()) { |
+ Send(new FrameMsg_UpdatePluginContentOriginWhitelist( |
+ render_frame_host->GetRoutingID(), GetPluginContentOriginWhitelist())); |
+ } |
} |
void WebContentsImpl::RenderFrameDeleted(RenderFrameHost* render_frame_host) { |
- ClearPowerSaveBlockers(render_frame_host); |
+ if (!is_being_destroyed_) { |
+ ClearPowerSaveBlockers(render_frame_host); |
Lei Zhang
2014/10/29 09:26:47
This was fine before. Leave it alone?
tommycli
2014/10/29 19:59:23
Done.
|
+ |
+ size_t erased = plugin_content_origin_whitelist_.erase(render_frame_host); |
+ if (erased > 0) { |
+ SendToAllFrames(new FrameMsg_UpdatePluginContentOriginWhitelist( |
Lei Zhang
2014/10/29 09:26:47
Do we have to do this? Imagine a web page with sma
tommycli
2014/10/29 19:59:23
Done.
|
+ MSG_ROUTING_NONE, GetPluginContentOriginWhitelist())); |
+ } |
+ } |
+ |
FOR_EACH_OBSERVER(WebContentsObserver, |
observers_, |
RenderFrameDeleted(render_frame_host)); |
@@ -4320,6 +4347,16 @@ void WebContentsImpl::RemoveAllMediaPlayerEntries( |
player_map->erase(it); |
} |
+std::set<GURL> WebContentsImpl::GetPluginContentOriginWhitelist() { |
+ std::set<GURL> whitelisted_origins; |
+ for (const auto& whitelist_for_frame : plugin_content_origin_whitelist_) { |
+ for (const auto& origin : whitelist_for_frame.second) { |
+ whitelisted_origins.insert(origin); |
+ } |
+ } |
+ return whitelisted_origins; |
+} |
+ |
void WebContentsImpl::ResumeResponseDeferredAtStart() { |
FrameTreeNode* node = frame_tree_.root(); |
node->render_manager()->ResumeResponseDeferredAtStart(); |