summaryrefslogtreecommitdiffstats
path: root/extensions/browser/info_map.cc
diff options
context:
space:
mode:
authorpeter <peter@chromium.org>2015-07-02 05:10:51 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-02 12:11:29 +0000
commitb514ab0de3c448941a4b3d16d5984b042e3d51c0 (patch)
tree14f118b1b98f21a66be5109e818b85e59fd0b5da /extensions/browser/info_map.cc
parent56116f4d5ff944b3f942fbb451911f78d8f8b0af (diff)
downloadchromium_src-b514ab0de3c448941a4b3d16d5984b042e3d51c0.zip
chromium_src-b514ab0de3c448941a4b3d16d5984b042e3d51c0.tar.gz
chromium_src-b514ab0de3c448941a4b3d16d5984b042e3d51c0.tar.bz2
Simplify permission-related code for Web Notifications.
(1) Remove support for inheriting the "notification" API permission for packaged and hosted apps using the Web Notification API. This has been inadvertently broken since Chrome 42. (2) Give notifications a dedicated NotificationPermissionContext, similar to those other features have. (+ unit tests) (3) Remove and clean up all unused code. This further emphasizes the DesktopNotificationService as a deprecated concept. I'll remove it entirely in a follow-up patch. BUG=504361 Review URL: https://codereview.chromium.org/1207363002 Cr-Commit-Position: refs/heads/master@{#337206}
Diffstat (limited to 'extensions/browser/info_map.cc')
-rw-r--r--extensions/browser/info_map.cc40
1 files changed, 12 insertions, 28 deletions
diff --git a/extensions/browser/info_map.cc b/extensions/browser/info_map.cc
index 00b2437..c97832c 100644
--- a/extensions/browser/info_map.cc
+++ b/extensions/browser/info_map.cc
@@ -129,42 +129,26 @@ void InfoMap::UnregisterAllExtensionsInProcess(int process_id) {
process_map_.RemoveAllFromProcess(process_id);
}
-void InfoMap::GetExtensionsWithAPIPermissionForSecurityOrigin(
+bool InfoMap::SecurityOriginHasAPIPermission(
const GURL& origin,
int process_id,
- APIPermission::ID permission,
- ExtensionSet* extensions) const {
- DCHECK(extensions);
-
+ APIPermission::ID permission) const {
+ CheckOnValidThread();
if (origin.SchemeIs(kExtensionScheme)) {
const std::string& id = origin.host();
const Extension* extension = extensions_.GetByID(id);
- if (extension &&
- extension->permissions_data()->HasAPIPermission(permission) &&
- process_map_.Contains(id, process_id)) {
- extensions->Insert(extension);
- }
- return;
+ return extension &&
+ extension->permissions_data()->HasAPIPermission(permission) &&
+ process_map_.Contains(id, process_id);
}
-
- ExtensionSet::const_iterator i = extensions_.begin();
- for (; i != extensions_.end(); ++i) {
- if ((*i)->web_extent().MatchesSecurityOrigin(origin) &&
- process_map_.Contains((*i)->id(), process_id) &&
- (*i)->permissions_data()->HasAPIPermission(permission)) {
- extensions->Insert(*i);
+ for (const auto& extension : extensions_) {
+ if (extension->web_extent().MatchesSecurityOrigin(origin) &&
+ extension->permissions_data()->HasAPIPermission(permission) &&
+ process_map_.Contains(extension->id(), process_id)) {
+ return true;
}
}
-}
-
-bool InfoMap::SecurityOriginHasAPIPermission(const GURL& origin,
- int process_id,
- APIPermission::ID permission)
- const {
- ExtensionSet extensions;
- GetExtensionsWithAPIPermissionForSecurityOrigin(
- origin, process_id, permission, &extensions);
- return !extensions.is_empty();
+ return false;
}
// This function is security sensitive. Bugs could cause problems that break