Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1433)

Side by Side Diff: extensions/common/permissions/api_permission_set.cc

Issue 1042793003: Extensions: Switch to new permission message system, part II (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permissions_switch
Patch Set: review Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/api_permission_set.h" 5 #include "extensions/common/permissions/api_permission_set.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } 248 }
249 } 249 }
250 return subset; 250 return subset;
251 } 251 }
252 252
253 bool PermissionIDSet::Includes(const PermissionIDSet& subset) const { 253 bool PermissionIDSet::Includes(const PermissionIDSet& subset) const {
254 return base::STLIncludes<std::set<PermissionID>>(permissions_, 254 return base::STLIncludes<std::set<PermissionID>>(permissions_,
255 subset.permissions_); 255 subset.permissions_);
256 } 256 }
257 257
258 bool PermissionIDSet::Equals(const PermissionIDSet& set) const {
259 return permissions_ == set.permissions_;
260 }
261
258 // static 262 // static
259 PermissionIDSet PermissionIDSet::Difference(const PermissionIDSet& set_1, 263 PermissionIDSet PermissionIDSet::Difference(const PermissionIDSet& set_1,
260 const PermissionIDSet& set_2) { 264 const PermissionIDSet& set_2) {
261 return PermissionIDSet(base::STLSetDifference<std::set<PermissionID>>( 265 return PermissionIDSet(base::STLSetDifference<std::set<PermissionID>>(
262 set_1.permissions_, set_2.permissions_)); 266 set_1.permissions_, set_2.permissions_));
263 } 267 }
264 268
265 // static 269 // static
266 PermissionIDSet PermissionIDSet::Intersection(const PermissionIDSet& set_1, 270 PermissionIDSet PermissionIDSet::Intersection(const PermissionIDSet& set_1,
267 const PermissionIDSet& set_2) { 271 const PermissionIDSet& set_2) {
(...skipping 25 matching lines...) Expand all
293 PermissionIDSet subset; 297 PermissionIDSet subset;
294 for (const auto& permission : permissions_) { 298 for (const auto& permission : permissions_) {
295 if (permission.id() == permission_id) { 299 if (permission.id() == permission_id) {
296 return true; 300 return true;
297 } 301 }
298 } 302 }
299 return false; 303 return false;
300 } 304 }
301 305
302 } // namespace extensions 306 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698