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::HasHostPermission(extension, url) || | 136 extensions::PermissionsData::ForExtension(extension) |
not at google - send to devlin
2014/06/02 23:20:06
here
Devlin
2014/06/03 15:28:21
Not done. Reusing pointer makes no cases faster an
not at google - send to devlin
2014/06/03 15:45:16
fine, but note that I'm not worried about the perf
Devlin
2014/06/03 15:48:00
Agreed, and if it's a wash in speed, no problem, b
| |
137 ->HasHostPermission(url) || | |
137 url.GetOrigin() == extension->url()))) { | 138 url.GetOrigin() == extension->url()))) { |
138 return false; | 139 return false; |
139 } | 140 } |
140 break; | 141 break; |
141 case REQUIRE_ALL_URLS: | 142 case REQUIRE_ALL_URLS: |
142 if (!extensions::PermissionsData::HasEffectiveAccessToAllHosts(extension)) | 143 if (!extensions::PermissionsData::ForExtension(extension) |
144 ->HasEffectiveAccessToAllHosts()) | |
143 return false; | 145 return false; |
144 break; | 146 break; |
145 } | 147 } |
146 | 148 |
147 return true; | 149 return true; |
148 } | 150 } |
OLD | NEW |