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 <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 return active_permissions_unsafe_->HasEffectiveAccessToAllHosts(); | 216 return active_permissions_unsafe_->HasEffectiveAccessToAllHosts(); |
217 } | 217 } |
218 | 218 |
219 PermissionMessages PermissionsData::GetPermissionMessages() const { | 219 PermissionMessages PermissionsData::GetPermissionMessages() const { |
220 base::AutoLock auto_lock(runtime_lock_); | 220 base::AutoLock auto_lock(runtime_lock_); |
221 return PermissionMessageProvider::Get()->GetPermissionMessages( | 221 return PermissionMessageProvider::Get()->GetPermissionMessages( |
222 PermissionMessageProvider::Get()->GetAllPermissionIDs( | 222 PermissionMessageProvider::Get()->GetAllPermissionIDs( |
223 *active_permissions_unsafe_, manifest_type_)); | 223 *active_permissions_unsafe_, manifest_type_)); |
224 } | 224 } |
225 | 225 |
| 226 PermissionMessages PermissionsData::GetPermissionMessages( |
| 227 const PermissionSet& permissions) const { |
| 228 base::AutoLock auto_lock(runtime_lock_); |
| 229 return PermissionMessageProvider::Get()->GetPermissionMessages( |
| 230 PermissionMessageProvider::Get()->GetAllPermissionIDs(permissions, |
| 231 manifest_type_)); |
| 232 } |
| 233 |
226 bool PermissionsData::HasWithheldImpliedAllHosts() const { | 234 bool PermissionsData::HasWithheldImpliedAllHosts() const { |
227 base::AutoLock auto_lock(runtime_lock_); | 235 base::AutoLock auto_lock(runtime_lock_); |
228 // Since we currently only withhold all_hosts, it's sufficient to check | 236 // Since we currently only withhold all_hosts, it's sufficient to check |
229 // that either set is not empty. | 237 // that either set is not empty. |
230 return !withheld_permissions_unsafe_->explicit_hosts().is_empty() || | 238 return !withheld_permissions_unsafe_->explicit_hosts().is_empty() || |
231 !withheld_permissions_unsafe_->scriptable_hosts().is_empty(); | 239 !withheld_permissions_unsafe_->scriptable_hosts().is_empty(); |
232 } | 240 } |
233 | 241 |
234 bool PermissionsData::CanAccessPage(const Extension* extension, | 242 bool PermissionsData::CanAccessPage(const Extension* extension, |
235 const GURL& document_url, | 243 const GURL& document_url, |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 manifest_errors::kCannotAccessPageWithUrl, document_url.spec()); | 368 manifest_errors::kCannotAccessPageWithUrl, document_url.spec()); |
361 } else { | 369 } else { |
362 *error = manifest_errors::kCannotAccessPage; | 370 *error = manifest_errors::kCannotAccessPage; |
363 } | 371 } |
364 } | 372 } |
365 | 373 |
366 return ACCESS_DENIED; | 374 return ACCESS_DENIED; |
367 } | 375 } |
368 | 376 |
369 } // namespace extensions | 377 } // namespace extensions |
OLD | NEW |