| 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/browser/extensions/api/web_request/web_request_permissions.h" | 5 #include "chrome/browser/extensions/api/web_request/web_request_permissions.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "chrome/browser/extensions/extension_renderer_state.h" | 9 #include "chrome/browser/extensions/extension_renderer_state.h" |
| 10 #include "chrome/common/extensions/extension_constants.h" | 10 #include "chrome/common/extensions/extension_constants.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 if (crosses_incognito && !extension_info_map->CanCrossIncognito(extension)) | 126 if (crosses_incognito && !extension_info_map->CanCrossIncognito(extension)) |
| 127 return false; | 127 return false; |
| 128 | 128 |
| 129 switch (host_permissions_check) { | 129 switch (host_permissions_check) { |
| 130 case DO_NOT_CHECK_HOST: | 130 case DO_NOT_CHECK_HOST: |
| 131 break; | 131 break; |
| 132 case REQUIRE_HOST_PERMISSION: | 132 case REQUIRE_HOST_PERMISSION: |
| 133 // about: URLs are not covered in host permissions, but are allowed | 133 // about: URLs are not covered in host permissions, but are allowed |
| 134 // anyway. | 134 // anyway. |
| 135 if (!((url.SchemeIs(content::kAboutScheme) || | 135 if (!((url.SchemeIs(content::kAboutScheme) || |
| 136 extensions::PermissionsData::ForExtension(extension) | 136 extension->permissions_data()->HasHostPermission(url) || |
| 137 ->HasHostPermission(url) || | |
| 138 url.GetOrigin() == extension->url()))) { | 137 url.GetOrigin() == extension->url()))) { |
| 139 return false; | 138 return false; |
| 140 } | 139 } |
| 141 break; | 140 break; |
| 142 case REQUIRE_ALL_URLS: | 141 case REQUIRE_ALL_URLS: |
| 143 if (!extensions::PermissionsData::ForExtension(extension) | 142 if (!extension->permissions_data()->HasEffectiveAccessToAllHosts()) |
| 144 ->HasEffectiveAccessToAllHosts()) | |
| 145 return false; | 143 return false; |
| 146 break; | 144 break; |
| 147 } | 145 } |
| 148 | 146 |
| 149 return true; | 147 return true; |
| 150 } | 148 } |
| OLD | NEW |