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/navigation_details.h" | 8 #include "content/public/browser/navigation_details.h" |
9 #include "content/public/browser/render_frame_host.h" | 9 #include "content/public/browser/render_frame_host.h" |
10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // frames that are not in an extension process. | 63 // frames that are not in an extension process. |
64 if (!frame_extension) | 64 if (!frame_extension) |
65 return; | 65 return; |
66 | 66 |
67 // |render_frame_host->GetProcess()| is an extension process. Grant permission | 67 // |render_frame_host->GetProcess()| is an extension process. Grant permission |
68 // to commit pages from chrome-extension:// origins. | 68 // to commit pages from chrome-extension:// origins. |
69 content::ChildProcessSecurityPolicy* security_policy = | 69 content::ChildProcessSecurityPolicy* security_policy = |
70 content::ChildProcessSecurityPolicy::GetInstance(); | 70 content::ChildProcessSecurityPolicy::GetInstance(); |
71 int process_id = render_frame_host->GetProcess()->GetID(); | 71 int process_id = render_frame_host->GetProcess()->GetID(); |
72 security_policy->GrantScheme(process_id, extensions::kExtensionScheme); | 72 security_policy->GrantScheme(process_id, extensions::kExtensionScheme); |
73 security_policy->GrantScheme(process_id, | |
74 extensions::kExtensionResourceScheme); | |
75 | 73 |
76 // Notify the render frame of the view type. | 74 // Notify the render frame of the view type. |
77 render_frame_host->Send(new ExtensionMsg_NotifyRenderViewType( | 75 render_frame_host->Send(new ExtensionMsg_NotifyRenderViewType( |
78 render_frame_host->GetRoutingID(), GetViewType(web_contents()))); | 76 render_frame_host->GetRoutingID(), GetViewType(web_contents()))); |
79 | 77 |
80 ExtensionsBrowserClient::Get()->RegisterMojoServices(render_frame_host, | 78 ExtensionsBrowserClient::Get()->RegisterMojoServices(render_frame_host, |
81 frame_extension); | 79 frame_extension); |
82 ProcessManager::Get(browser_context_) | 80 ProcessManager::Get(browser_context_) |
83 ->RegisterRenderFrameHost(web_contents(), render_frame_host, | 81 ->RegisterRenderFrameHost(web_contents(), render_frame_host, |
84 frame_extension); | 82 frame_extension); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 // Since this is called for all existing RenderFrameHosts during the | 290 // Since this is called for all existing RenderFrameHosts during the |
293 // ExtensionWebContentsObserver's creation, it's possible that not all hosts | 291 // ExtensionWebContentsObserver's creation, it's possible that not all hosts |
294 // are ready. | 292 // are ready. |
295 // We only initialize the frame if the renderer counterpart is live; otherwise | 293 // We only initialize the frame if the renderer counterpart is live; otherwise |
296 // we wait for the RenderFrameCreated notification. | 294 // we wait for the RenderFrameCreated notification. |
297 if (render_frame_host->IsRenderFrameLive()) | 295 if (render_frame_host->IsRenderFrameLive()) |
298 InitializeRenderFrame(render_frame_host); | 296 InitializeRenderFrame(render_frame_host); |
299 } | 297 } |
300 | 298 |
301 } // namespace extensions | 299 } // namespace extensions |
OLD | NEW |