| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 bool PermissionSet::HasAPIPermission( | 175 bool PermissionSet::HasAPIPermission( |
| 176 APIPermission::ID id) const { | 176 APIPermission::ID id) const { |
| 177 return apis().find(id) != apis().end(); | 177 return apis().find(id) != apis().end(); |
| 178 } | 178 } |
| 179 | 179 |
| 180 bool PermissionSet::HasAPIPermission(const std::string& permission_name) const { | 180 bool PermissionSet::HasAPIPermission(const std::string& permission_name) const { |
| 181 const APIPermissionInfo* permission = | 181 const APIPermissionInfo* permission = |
| 182 PermissionsInfo::GetInstance()->GetByName(permission_name); | 182 PermissionsInfo::GetInstance()->GetByName(permission_name); |
| 183 // Ensure our PermissionsProvider is aware of this permission. |
| 183 CHECK(permission) << permission_name; | 184 CHECK(permission) << permission_name; |
| 184 return (permission && apis_.count(permission->id())); | 185 return (permission && apis_.count(permission->id())); |
| 185 } | 186 } |
| 186 | 187 |
| 187 bool PermissionSet::CheckAPIPermission(APIPermission::ID permission) const { | 188 bool PermissionSet::CheckAPIPermission(APIPermission::ID permission) const { |
| 188 return CheckAPIPermissionWithParam(permission, NULL); | 189 return CheckAPIPermissionWithParam(permission, NULL); |
| 189 } | 190 } |
| 190 | 191 |
| 191 bool PermissionSet::CheckAPIPermissionWithParam( | 192 bool PermissionSet::CheckAPIPermissionWithParam( |
| 192 APIPermission::ID permission, | 193 APIPermission::ID permission, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 } | 265 } |
| 265 | 266 |
| 266 void PermissionSet::InitEffectiveHosts() { | 267 void PermissionSet::InitEffectiveHosts() { |
| 267 effective_hosts_.ClearPatterns(); | 268 effective_hosts_.ClearPatterns(); |
| 268 | 269 |
| 269 URLPatternSet::CreateUnion( | 270 URLPatternSet::CreateUnion( |
| 270 explicit_hosts(), scriptable_hosts(), &effective_hosts_); | 271 explicit_hosts(), scriptable_hosts(), &effective_hosts_); |
| 271 } | 272 } |
| 272 | 273 |
| 273 } // namespace extensions | 274 } // namespace extensions |
| OLD | NEW |