| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/common/permissions/permissions_data.h" | 5 #include "extensions/common/permissions/permissions_data.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "content/public/common/url_constants.h" | 8 #include "content/public/common/url_constants.h" |
| 9 #include "extensions/common/constants.h" | 9 #include "extensions/common/constants.h" |
| 10 #include "extensions/common/error_utils.h" | 10 #include "extensions/common/error_utils.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 base::AutoLock auto_lock(runtime_lock_); | 163 base::AutoLock auto_lock(runtime_lock_); |
| 164 return tab_permissions.get() && tab_permissions->HasAPIPermission(permission); | 164 return tab_permissions.get() && tab_permissions->HasAPIPermission(permission); |
| 165 } | 165 } |
| 166 | 166 |
| 167 bool PermissionsData::CheckAPIPermissionWithParam( | 167 bool PermissionsData::CheckAPIPermissionWithParam( |
| 168 APIPermission::ID permission, | 168 APIPermission::ID permission, |
| 169 const APIPermission::CheckParam* param) const { | 169 const APIPermission::CheckParam* param) const { |
| 170 return active_permissions()->CheckAPIPermissionWithParam(permission, param); | 170 return active_permissions()->CheckAPIPermissionWithParam(permission, param); |
| 171 } | 171 } |
| 172 | 172 |
| 173 const URLPatternSet& PermissionsData::GetEffectiveHostPermissions() const { | 173 URLPatternSet PermissionsData::GetEffectiveHostPermissions() const { |
| 174 return active_permissions()->effective_hosts(); | 174 base::AutoLock auto_lock(runtime_lock_); |
| 175 URLPatternSet effective_hosts = active_permissions_unsafe_->effective_hosts(); |
| 176 for (const auto& val : tab_specific_permissions_) |
| 177 effective_hosts.AddPatterns(val.second->effective_hosts()); |
| 178 return effective_hosts; |
| 175 } | 179 } |
| 176 | 180 |
| 177 bool PermissionsData::HasHostPermission(const GURL& url) const { | 181 bool PermissionsData::HasHostPermission(const GURL& url) const { |
| 178 return active_permissions()->HasExplicitAccessToOrigin(url); | 182 return active_permissions()->HasExplicitAccessToOrigin(url); |
| 179 } | 183 } |
| 180 | 184 |
| 181 bool PermissionsData::HasEffectiveAccessToAllHosts() const { | 185 bool PermissionsData::HasEffectiveAccessToAllHosts() const { |
| 182 return active_permissions()->HasEffectiveAccessToAllHosts(); | 186 return active_permissions()->HasEffectiveAccessToAllHosts(); |
| 183 } | 187 } |
| 184 | 188 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 return ACCESS_WITHHELD; | 364 return ACCESS_WITHHELD; |
| 361 | 365 |
| 362 if (error) { | 366 if (error) { |
| 363 *error = ErrorUtils::FormatErrorMessage(manifest_errors::kCannotAccessPage, | 367 *error = ErrorUtils::FormatErrorMessage(manifest_errors::kCannotAccessPage, |
| 364 document_url.spec()); | 368 document_url.spec()); |
| 365 } | 369 } |
| 366 return ACCESS_DENIED; | 370 return ACCESS_DENIED; |
| 367 } | 371 } |
| 368 | 372 |
| 369 } // namespace extensions | 373 } // namespace extensions |
| OLD | NEW |