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 |
|
shaktisahu
2017/01/31 01:57:53
Changes in this file will be replaced by fix of cr
| |
| 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 "components/guest_view/browser/guest_view_base.h" | 7 #include "components/guest_view/browser/guest_view_base.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "content/public/browser/navigation_handle.h" | 9 #include "content/public/browser/navigation_handle.h" |
| 10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
| 11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 #include "content/public/common/browser_side_navigation_policy.h" | 12 #include "content/public/common/browser_side_navigation_policy.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 std::string resource_path = url.path(); | 83 std::string resource_path = url.path(); |
| 84 bool is_guest = WebViewGuest::GetGuestPartitionConfigForSite( | 84 bool is_guest = WebViewGuest::GetGuestPartitionConfigForSite( |
| 85 navigation_handle()->GetStartingSiteInstance()->GetSiteURL(), | 85 navigation_handle()->GetStartingSiteInstance()->GetSiteURL(), |
| 86 &partition_domain, &partition_id, &in_memory); | 86 &partition_domain, &partition_id, &in_memory); |
| 87 | 87 |
| 88 bool allowed = true; | 88 bool allowed = true; |
| 89 url_request_util::AllowCrossRendererResourceLoadHelper( | 89 url_request_util::AllowCrossRendererResourceLoadHelper( |
| 90 is_guest, extension, owner_extension, partition_id, resource_path, | 90 is_guest, extension, owner_extension, partition_id, resource_path, |
| 91 navigation_handle()->GetPageTransition(), &allowed); | 91 navigation_handle()->GetPageTransition(), &allowed); |
| 92 if (!allowed) | 92 if (!allowed) |
| 93 return content::NavigationThrottle::CANCEL; | 93 return content::NavigationThrottle::BLOCK_REQUEST; |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 return content::NavigationThrottle::PROCEED; | 97 return content::NavigationThrottle::PROCEED; |
| 98 } | 98 } |
| 99 | 99 |
| 100 // Now enforce web_accessible_resources for navigations. Top-level navigations | 100 // Now enforce web_accessible_resources for navigations. Top-level navigations |
| 101 // should always be allowed. | 101 // should always be allowed. |
| 102 | 102 |
| 103 // If the navigation is not to a chrome-extension:// URL, no need to perform | 103 // If the navigation is not to a chrome-extension:// URL, no need to perform |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 | 154 |
| 155 if (WebAccessibleResourcesInfo::IsResourceWebAccessible(extension, | 155 if (WebAccessibleResourcesInfo::IsResourceWebAccessible(extension, |
| 156 resource_path)) { | 156 resource_path)) { |
| 157 return content::NavigationThrottle::PROCEED; | 157 return content::NavigationThrottle::PROCEED; |
| 158 } | 158 } |
| 159 | 159 |
| 160 return content::NavigationThrottle::BLOCK_REQUEST; | 160 return content::NavigationThrottle::BLOCK_REQUEST; |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace extensions | 163 } // namespace extensions |
| OLD | NEW |