diff options
author | rdevlin.cronin <rdevlin.cronin@chromium.org> | 2015-09-16 16:38:15 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-16 23:39:07 +0000 |
commit | 5bfcd6ec4dce45ed787865e6258757fac0cea537 (patch) | |
tree | 09d045c5b2c5b1e98664ac69c1bd39f8d8c83c12 /extensions/common/permissions | |
parent | 47aeb2a8808dd9b51242ac0be2591c54b7668f50 (diff) | |
download | chromium_src-5bfcd6ec4dce45ed787865e6258757fac0cea537.zip chromium_src-5bfcd6ec4dce45ed787865e6258757fac0cea537.tar.gz chromium_src-5bfcd6ec4dce45ed787865e6258757fac0cea537.tar.bz2 |
[Extensions] Make URLPatternSet set methods return an URLPatternSet
URLPatternSet methods have a void return, take in an |out| parameter, clear it,
and do work. URLPatternSets are copyable. These methods should just be normal,
and return the result. RVO is a beautiful thing.
Review URL: https://codereview.chromium.org/1353543003
Cr-Commit-Position: refs/heads/master@{#349278}
Diffstat (limited to 'extensions/common/permissions')
-rw-r--r-- | extensions/common/permissions/permission_set.cc | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/extensions/common/permissions/permission_set.cc b/extensions/common/permissions/permission_set.cc index 194f37f8..4687102 100644 --- a/extensions/common/permissions/permission_set.cc +++ b/extensions/common/permissions/permission_set.cc @@ -59,15 +59,11 @@ PermissionSet* PermissionSet::CreateDifference( set2_safe->manifest_permissions(), &manifest_permissions); - URLPatternSet explicit_hosts; - URLPatternSet::CreateDifference(set1_safe->explicit_hosts(), - set2_safe->explicit_hosts(), - &explicit_hosts); + URLPatternSet explicit_hosts = URLPatternSet::CreateDifference( + set1_safe->explicit_hosts(), set2_safe->explicit_hosts()); - URLPatternSet scriptable_hosts; - URLPatternSet::CreateDifference(set1_safe->scriptable_hosts(), - set2_safe->scriptable_hosts(), - &scriptable_hosts); + URLPatternSet scriptable_hosts = URLPatternSet::CreateDifference( + set1_safe->scriptable_hosts(), set2_safe->scriptable_hosts()); return new PermissionSet(apis, manifest_permissions, explicit_hosts, scriptable_hosts); @@ -114,15 +110,11 @@ PermissionSet* PermissionSet::CreateUnion( set2_safe->manifest_permissions(), &manifest_permissions); - URLPatternSet explicit_hosts; - URLPatternSet::CreateUnion(set1_safe->explicit_hosts(), - set2_safe->explicit_hosts(), - &explicit_hosts); + URLPatternSet explicit_hosts = URLPatternSet::CreateUnion( + set1_safe->explicit_hosts(), set2_safe->explicit_hosts()); - URLPatternSet scriptable_hosts; - URLPatternSet::CreateUnion(set1_safe->scriptable_hosts(), - set2_safe->scriptable_hosts(), - &scriptable_hosts); + URLPatternSet scriptable_hosts = URLPatternSet::CreateUnion( + set1_safe->scriptable_hosts(), set2_safe->scriptable_hosts()); return new PermissionSet(apis, manifest_permissions, explicit_hosts, scriptable_hosts); @@ -251,10 +243,8 @@ void PermissionSet::InitImplicitPermissions() { } void PermissionSet::InitEffectiveHosts() { - effective_hosts_.ClearPatterns(); - - URLPatternSet::CreateUnion( - explicit_hosts(), scriptable_hosts(), &effective_hosts_); + effective_hosts_ = + URLPatternSet::CreateUnion(explicit_hosts(), scriptable_hosts()); } void PermissionSet::InitShouldWarnAllHosts() const { |