| 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/url_request_util.h" | 5 #include "extensions/browser/url_request_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "content/public/browser/resource_request_info.h" | 9 #include "content/public/browser/resource_request_info.h" |
| 10 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" | 10 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 | 40 |
| 41 // If the request is for navigations outside of webviews, then it should be | 41 // If the request is for navigations outside of webviews, then it should be |
| 42 // allowed. The navigation logic in CrossSiteResourceHandler will properly | 42 // allowed. The navigation logic in CrossSiteResourceHandler will properly |
| 43 // transfer the navigation to a privileged process before it commits. | 43 // transfer the navigation to a privileged process before it commits. |
| 44 if (content::IsResourceTypeFrame(info->GetResourceType()) && !is_guest) { | 44 if (content::IsResourceTypeFrame(info->GetResourceType()) && !is_guest) { |
| 45 *allowed = true; | 45 *allowed = true; |
| 46 return true; | 46 return true; |
| 47 } | 47 } |
| 48 | 48 |
| 49 if (!content::PageTransitionIsWebTriggerable(info->GetPageTransition())) { | 49 if (!ui::PageTransitionIsWebTriggerable(info->GetPageTransition())) { |
| 50 *allowed = false; | 50 *allowed = false; |
| 51 return true; | 51 return true; |
| 52 } | 52 } |
| 53 | 53 |
| 54 // The following checks require that we have an actual extension object. If we | 54 // The following checks require that we have an actual extension object. If we |
| 55 // don't have it, allow the request handling to continue with the rest of the | 55 // don't have it, allow the request handling to continue with the rest of the |
| 56 // checks. | 56 // checks. |
| 57 if (!extension) { | 57 if (!extension) { |
| 58 *allowed = true; | 58 *allowed = true; |
| 59 return true; | 59 return true; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 const content::ResourceRequestInfo* info = | 93 const content::ResourceRequestInfo* info = |
| 94 content::ResourceRequestInfo::ForRequest(request); | 94 content::ResourceRequestInfo::ForRequest(request); |
| 95 // |info| can be NULL sometimes: http://crbug.com/370070. | 95 // |info| can be NULL sometimes: http://crbug.com/370070. |
| 96 if (!info) | 96 if (!info) |
| 97 return false; | 97 return false; |
| 98 return WebViewRendererState::GetInstance()->IsGuest(info->GetChildID()); | 98 return WebViewRendererState::GetInstance()->IsGuest(info->GetChildID()); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace url_request_util | 101 } // namespace url_request_util |
| 102 } // namespace extensions | 102 } // namespace extensions |
| OLD | NEW |