Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_navigation_throttle.h" | 5 #include "extensions/browser/extension_navigation_throttle.h" |
| 6 | 6 |
| 7 #include "content/public/browser/browser_thread.h" | 7 #include "content/public/browser/browser_thread.h" |
| 8 #include "content/public/browser/navigation_handle.h" | 8 #include "content/public/browser/navigation_handle.h" |
| 9 #include "content/public/browser/render_frame_host.h" | 9 #include "content/public/browser/render_frame_host.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 } | 71 } |
| 72 | 72 |
| 73 if (!external_ancestor) | 73 if (!external_ancestor) |
| 74 return content::NavigationThrottle::PROCEED; | 74 return content::NavigationThrottle::PROCEED; |
| 75 | 75 |
| 76 // Since there was at least one origin different than the navigation URL, | 76 // Since there was at least one origin different than the navigation URL, |
| 77 // explicitly check for the resource in web_accessible_resources. | 77 // explicitly check for the resource in web_accessible_resources. |
| 78 std::string resource_path = navigation_handle()->GetURL().path(); | 78 std::string resource_path = navigation_handle()->GetURL().path(); |
| 79 ExtensionRegistry* registry = ExtensionRegistry::Get( | 79 ExtensionRegistry* registry = ExtensionRegistry::Get( |
| 80 navigation_handle()->GetWebContents()->GetBrowserContext()); | 80 navigation_handle()->GetWebContents()->GetBrowserContext()); |
| 81 if (!registry) | |
| 82 return content::NavigationThrottle::BLOCK_REQUEST; | |
|
asargent_no_longer_on_chrome
2016/06/08 18:30:13
Off the top of my head I can't think of situations
| |
| 83 | |
| 81 const extensions::Extension* extension = | 84 const extensions::Extension* extension = |
| 82 registry->enabled_extensions().GetByID( | 85 registry->enabled_extensions().GetByID( |
| 83 navigation_handle()->GetURL().host()); | 86 navigation_handle()->GetURL().host()); |
| 87 if (!extension) | |
| 88 return content::NavigationThrottle::BLOCK_REQUEST; | |
| 84 | 89 |
| 85 if (WebAccessibleResourcesInfo::IsResourceWebAccessible(extension, | 90 if (WebAccessibleResourcesInfo::IsResourceWebAccessible(extension, |
| 86 resource_path)) { | 91 resource_path)) { |
| 87 return content::NavigationThrottle::PROCEED; | 92 return content::NavigationThrottle::PROCEED; |
| 88 } | 93 } |
| 89 | 94 |
| 90 return content::NavigationThrottle::BLOCK_REQUEST; | 95 return content::NavigationThrottle::BLOCK_REQUEST; |
| 91 } | 96 } |
| 92 | 97 |
| 93 } // namespace extensions | 98 } // namespace extensions |
| OLD | NEW |