| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/permission_set.h" | 5 #include "extensions/common/permissions/permission_set.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "extensions/common/permissions/permissions_info.h" | 10 #include "extensions/common/permissions/permissions_info.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 bool PermissionSet::HasAPIPermission( | 157 bool PermissionSet::HasAPIPermission( |
| 158 APIPermission::ID id) const { | 158 APIPermission::ID id) const { |
| 159 return apis().find(id) != apis().end(); | 159 return apis().find(id) != apis().end(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 bool PermissionSet::HasAPIPermission(const std::string& permission_name) const { | 162 bool PermissionSet::HasAPIPermission(const std::string& permission_name) const { |
| 163 const APIPermissionInfo* permission = | 163 const APIPermissionInfo* permission = |
| 164 PermissionsInfo::GetInstance()->GetByName(permission_name); | 164 PermissionsInfo::GetInstance()->GetByName(permission_name); |
| 165 // Ensure our PermissionsProvider is aware of this permission. | 165 // Ensure our PermissionsProvider is aware of this permission. |
| 166 CHECK(permission) << permission_name; | 166 CHECK(permission); |
| 167 return (permission && apis_.count(permission->id())); | 167 return (permission && apis_.count(permission->id())); |
| 168 } | 168 } |
| 169 | 169 |
| 170 bool PermissionSet::CheckAPIPermission(APIPermission::ID permission) const { | 170 bool PermissionSet::CheckAPIPermission(APIPermission::ID permission) const { |
| 171 return CheckAPIPermissionWithParam(permission, NULL); | 171 return CheckAPIPermissionWithParam(permission, NULL); |
| 172 } | 172 } |
| 173 | 173 |
| 174 bool PermissionSet::CheckAPIPermissionWithParam( | 174 bool PermissionSet::CheckAPIPermissionWithParam( |
| 175 APIPermission::ID permission, | 175 APIPermission::ID permission, |
| 176 const APIPermission::CheckParam* param) const { | 176 const APIPermission::CheckParam* param) const { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 if (iter->ImpliesAllHosts()) { | 262 if (iter->ImpliesAllHosts()) { |
| 263 should_warn_all_hosts_ = WARN_ALL_HOSTS; | 263 should_warn_all_hosts_ = WARN_ALL_HOSTS; |
| 264 return; | 264 return; |
| 265 } | 265 } |
| 266 } | 266 } |
| 267 | 267 |
| 268 should_warn_all_hosts_ = DONT_WARN_ALL_HOSTS; | 268 should_warn_all_hosts_ = DONT_WARN_ALL_HOSTS; |
| 269 } | 269 } |
| 270 | 270 |
| 271 } // namespace extensions | 271 } // namespace extensions |
| OLD | NEW |