OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/extension_web_contents_observer.h" | 5 #include "extensions/browser/extension_web_contents_observer.h" |
6 | 6 |
7 #include "content/public/browser/child_process_security_policy.h" | 7 #include "content/public/browser/child_process_security_policy.h" |
8 #include "content/public/browser/render_frame_host.h" | 8 #include "content/public/browser/render_frame_host.h" |
9 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
10 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 content::RenderFrameHost* render_frame_host) { | 103 content::RenderFrameHost* render_frame_host) { |
104 InitializeRenderFrame(render_frame_host); | 104 InitializeRenderFrame(render_frame_host); |
105 } | 105 } |
106 | 106 |
107 void ExtensionWebContentsObserver::RenderFrameDeleted( | 107 void ExtensionWebContentsObserver::RenderFrameDeleted( |
108 content::RenderFrameHost* render_frame_host) { | 108 content::RenderFrameHost* render_frame_host) { |
109 ProcessManager::Get(browser_context_) | 109 ProcessManager::Get(browser_context_) |
110 ->UnregisterRenderFrameHost(render_frame_host); | 110 ->UnregisterRenderFrameHost(render_frame_host); |
111 } | 111 } |
112 | 112 |
113 void ExtensionWebContentsObserver::RenderFrameHostChanged( | |
Devlin
2015/10/30 01:21:44
We used to have this, and it was removed for some
| |
114 content::RenderFrameHost* old_host, | |
115 content::RenderFrameHost* new_host) { | |
116 if (new_host->IsRenderFrameLive()) | |
117 InitializeRenderFrame(new_host); | |
ncarter (slow)
2015/10/30 06:22:20
Does your test really fail if you don't add this o
robwu
2015/10/30 10:15:49
This override is needed, because the RFH's GetLast
ncarter (slow)
2015/10/30 15:53:44
I see. I'll take another look, then.
| |
118 } | |
119 | |
113 bool ExtensionWebContentsObserver::OnMessageReceived( | 120 bool ExtensionWebContentsObserver::OnMessageReceived( |
114 const IPC::Message& message, | 121 const IPC::Message& message, |
115 content::RenderFrameHost* render_frame_host) { | 122 content::RenderFrameHost* render_frame_host) { |
116 bool handled = true; | 123 bool handled = true; |
117 IPC_BEGIN_MESSAGE_MAP_WITH_PARAM( | 124 IPC_BEGIN_MESSAGE_MAP_WITH_PARAM( |
118 ExtensionWebContentsObserver, message, render_frame_host) | 125 ExtensionWebContentsObserver, message, render_frame_host) |
119 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) | 126 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) |
120 IPC_MESSAGE_UNHANDLED(handled = false) | 127 IPC_MESSAGE_UNHANDLED(handled = false) |
121 IPC_END_MESSAGE_MAP() | 128 IPC_END_MESSAGE_MAP() |
122 return handled; | 129 return handled; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 // Since this is called for all existing RenderFrameHosts during the | 210 // Since this is called for all existing RenderFrameHosts during the |
204 // ExtensionWebContentsObserver's creation, it's possible that not all hosts | 211 // ExtensionWebContentsObserver's creation, it's possible that not all hosts |
205 // are ready. | 212 // are ready. |
206 // We only initialize the frame if the renderer counterpart is live; otherwise | 213 // We only initialize the frame if the renderer counterpart is live; otherwise |
207 // we wait for the RenderFrameCreated notification. | 214 // we wait for the RenderFrameCreated notification. |
208 if (render_frame_host->IsRenderFrameLive()) | 215 if (render_frame_host->IsRenderFrameLive()) |
209 InitializeRenderFrame(render_frame_host); | 216 InitializeRenderFrame(render_frame_host); |
210 } | 217 } |
211 | 218 |
212 } // namespace extensions | 219 } // namespace extensions |
OLD | NEW |