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

Side by Side Diff: chrome/common/extensions/extension_permission_set.cc

Issue 10389137: Coverity: Fix pass by value error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/extension_permission_set.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/common/extensions/extension_permission_set.h" 5 #include "chrome/common/extensions/extension_permission_set.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 ExtensionPermissionsInfo* ExtensionPermissionsInfo::GetInstance() { 373 ExtensionPermissionsInfo* ExtensionPermissionsInfo::GetInstance() {
374 return Singleton<ExtensionPermissionsInfo>::get(); 374 return Singleton<ExtensionPermissionsInfo>::get();
375 } 375 }
376 376
377 ExtensionAPIPermission* ExtensionPermissionsInfo::GetByID( 377 ExtensionAPIPermission* ExtensionPermissionsInfo::GetByID(
378 ExtensionAPIPermission::ID id) { 378 ExtensionAPIPermission::ID id) {
379 IDMap::iterator i = id_map_.find(id); 379 IDMap::iterator i = id_map_.find(id);
380 return (i == id_map_.end()) ? NULL : i->second; 380 return (i == id_map_.end()) ? NULL : i->second;
381 } 381 }
382 382
383 ExtensionAPIPermission* ExtensionPermissionsInfo::GetByName(std::string name) { 383 ExtensionAPIPermission* ExtensionPermissionsInfo::GetByName(
384 const std::string& name) {
384 NameMap::iterator i = name_map_.find(name); 385 NameMap::iterator i = name_map_.find(name);
385 return (i == name_map_.end()) ? NULL : i->second; 386 return (i == name_map_.end()) ? NULL : i->second;
386 } 387 }
387 388
388 ExtensionAPIPermissionSet ExtensionPermissionsInfo::GetAll() { 389 ExtensionAPIPermissionSet ExtensionPermissionsInfo::GetAll() {
389 ExtensionAPIPermissionSet permissions; 390 ExtensionAPIPermissionSet permissions;
390 for (IDMap::const_iterator i = id_map_.begin(); i != id_map_.end(); ++i) 391 for (IDMap::const_iterator i = id_map_.begin(); i != id_map_.end(); ++i)
391 permissions.insert(i->second->id()); 392 permissions.insert(i->second->id());
392 return permissions; 393 return permissions;
393 } 394 }
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 ExtensionOAuth2Scopes current_scopes = scopes(); 963 ExtensionOAuth2Scopes current_scopes = scopes();
963 ExtensionOAuth2Scopes new_scopes = permissions->scopes(); 964 ExtensionOAuth2Scopes new_scopes = permissions->scopes();
964 ExtensionOAuth2Scopes delta_scopes; 965 ExtensionOAuth2Scopes delta_scopes;
965 std::set_difference(new_scopes.begin(), new_scopes.end(), 966 std::set_difference(new_scopes.begin(), new_scopes.end(),
966 current_scopes.begin(), current_scopes.end(), 967 current_scopes.begin(), current_scopes.end(),
967 std::inserter(delta_scopes, delta_scopes.begin())); 968 std::inserter(delta_scopes, delta_scopes.begin()));
968 969
969 // We have less privileges if there are additional scopes present. 970 // We have less privileges if there are additional scopes present.
970 return !delta_scopes.empty(); 971 return !delta_scopes.empty();
971 } 972 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_permission_set.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698