| 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_process_host.h" | 8 #include "content/public/browser/render_process_host.h" |
| 9 #include "content/public/browser/render_view_host.h" | 9 #include "content/public/browser/render_view_host.h" |
| 10 #include "content/public/browser/site_instance.h" | 10 #include "content/public/browser/site_instance.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 content::WebContents* web_contents) | 22 content::WebContents* web_contents) |
| 23 : content::WebContentsObserver(web_contents), | 23 : content::WebContentsObserver(web_contents), |
| 24 browser_context_(web_contents->GetBrowserContext()) { | 24 browser_context_(web_contents->GetBrowserContext()) { |
| 25 NotifyRenderViewType(web_contents->GetRenderViewHost()); | 25 NotifyRenderViewType(web_contents->GetRenderViewHost()); |
| 26 } | 26 } |
| 27 | 27 |
| 28 ExtensionWebContentsObserver::~ExtensionWebContentsObserver() {} | 28 ExtensionWebContentsObserver::~ExtensionWebContentsObserver() {} |
| 29 | 29 |
| 30 void ExtensionWebContentsObserver::RenderViewCreated( | 30 void ExtensionWebContentsObserver::RenderViewCreated( |
| 31 content::RenderViewHost* render_view_host) { | 31 content::RenderViewHost* render_view_host) { |
| 32 LOG(INFO) << "Render view created"; |
| 33 |
| 32 NotifyRenderViewType(render_view_host); | 34 NotifyRenderViewType(render_view_host); |
| 33 | 35 |
| 34 const Extension* extension = GetExtension(render_view_host); | 36 const Extension* extension = GetExtension(render_view_host); |
| 35 if (!extension) | 37 if (!extension) |
| 36 return; | 38 return; |
| 37 | 39 |
| 38 content::RenderProcessHost* process = render_view_host->GetProcess(); | 40 content::RenderProcessHost* process = render_view_host->GetProcess(); |
| 39 | 41 |
| 40 // Some extensions use chrome:// URLs. | 42 // Some extensions use chrome:// URLs. |
| 41 // This is a temporary solution. Replace it with access to chrome-static:// | 43 // This is a temporary solution. Replace it with access to chrome-static:// |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // site, so we can ignore that wrinkle here. | 116 // site, so we can ignore that wrinkle here. |
| 115 const GURL& site = render_view_host->GetSiteInstance()->GetSiteURL(); | 117 const GURL& site = render_view_host->GetSiteInstance()->GetSiteURL(); |
| 116 | 118 |
| 117 if (!site.SchemeIs(kExtensionScheme)) | 119 if (!site.SchemeIs(kExtensionScheme)) |
| 118 return std::string(); | 120 return std::string(); |
| 119 | 121 |
| 120 return site.host(); | 122 return site.host(); |
| 121 } | 123 } |
| 122 | 124 |
| 123 } // namespace extensions | 125 } // namespace extensions |
| OLD | NEW |