| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/renderer/extensions/resource_request_policy.h" | 5 #include "chrome/renderer/extensions/resource_request_policy.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 // Exceptions are: | 73 // Exceptions are: |
| 74 // - empty origin (needed for some edge cases when we have empty origins) | 74 // - empty origin (needed for some edge cases when we have empty origins) |
| 75 bool is_empty_origin = frame_url.is_empty(); | 75 bool is_empty_origin = frame_url.is_empty(); |
| 76 // - extensions requesting their own resources (frame_url check is for | 76 // - extensions requesting their own resources (frame_url check is for |
| 77 // images, page_url check is for iframes) | 77 // images, page_url check is for iframes) |
| 78 bool is_own_resource = frame_url.GetOrigin() == extension->url() || | 78 bool is_own_resource = frame_url.GetOrigin() == extension->url() || |
| 79 page_url.GetOrigin() == extension->url(); | 79 page_url.GetOrigin() == extension->url(); |
| 80 // - devtools (chrome-extension:// URLs are loaded into frames of devtools | 80 // - devtools (chrome-extension:// URLs are loaded into frames of devtools |
| 81 // to support the devtools extension APIs) | 81 // to support the devtools extension APIs) |
| 82 bool is_dev_tools = page_url.SchemeIs(chrome::kChromeDevToolsScheme) && | 82 bool is_dev_tools = page_url.SchemeIs(content::kChromeDevToolsScheme) && |
| 83 !ManifestURL::GetDevToolsPage(extension).is_empty(); | 83 !ManifestURL::GetDevToolsPage(extension).is_empty(); |
| 84 bool transition_allowed = | 84 bool transition_allowed = |
| 85 !content::PageTransitionIsWebTriggerable(transition_type); | 85 !content::PageTransitionIsWebTriggerable(transition_type); |
| 86 // - unreachable web page error page (to allow showing the icon of the | 86 // - unreachable web page error page (to allow showing the icon of the |
| 87 // unreachable app on this page) | 87 // unreachable app on this page) |
| 88 bool is_error_page = frame_url == GURL(content::kUnreachableWebDataURL); | 88 bool is_error_page = frame_url == GURL(content::kUnreachableWebDataURL); |
| 89 | 89 |
| 90 if (!is_empty_origin && !is_own_resource && | 90 if (!is_empty_origin && !is_own_resource && |
| 91 !is_dev_tools && !transition_allowed && !is_error_page) { | 91 !is_dev_tools && !transition_allowed && !is_error_page) { |
| 92 std::string message = base::StringPrintf( | 92 std::string message = base::StringPrintf( |
| (...skipping 30 matching lines...) Expand all Loading... |
| 123 return false; | 123 return false; |
| 124 } | 124 } |
| 125 | 125 |
| 126 return true; | 126 return true; |
| 127 } | 127 } |
| 128 | 128 |
| 129 ResourceRequestPolicy::ResourceRequestPolicy() { | 129 ResourceRequestPolicy::ResourceRequestPolicy() { |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace extensions | 132 } // namespace extensions |
| OLD | NEW |