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

Side by Side Diff: chrome/common/extensions/permissions/permission_set.cc

Issue 22460011: [CleanUp] Use base::STLSetDifference in place of std::set_difference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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 (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 "chrome/common/extensions/permissions/permission_set.h" 5 #include "chrome/common/extensions/permissions/permission_set.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <string> 9 #include <string>
10 10
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 return true; 538 return true;
539 539
540 const URLPatternSet& old_list = effective_hosts(); 540 const URLPatternSet& old_list = effective_hosts();
541 const URLPatternSet& new_list = permissions->effective_hosts(); 541 const URLPatternSet& new_list = permissions->effective_hosts();
542 542
543 // TODO(jstritar): This is overly conservative with respect to subdomains. 543 // TODO(jstritar): This is overly conservative with respect to subdomains.
544 // For example, going from *.google.com to www.google.com will be 544 // For example, going from *.google.com to www.google.com will be
545 // considered an elevation, even though it is not (http://crbug.com/65337). 545 // considered an elevation, even though it is not (http://crbug.com/65337).
546 std::set<std::string> new_hosts_set(GetDistinctHosts(new_list, false, false)); 546 std::set<std::string> new_hosts_set(GetDistinctHosts(new_list, false, false));
547 std::set<std::string> old_hosts_set(GetDistinctHosts(old_list, false, false)); 547 std::set<std::string> old_hosts_set(GetDistinctHosts(old_list, false, false));
548 std::set<std::string> new_hosts_only; 548 std::set<std::string> new_hosts_only =
549 549 base::STLSetDifference<std::set<std::string> >(new_hosts_set,
550 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), 550 old_hosts_set);
551 old_hosts_set.begin(), old_hosts_set.end(),
552 std::inserter(new_hosts_only, new_hosts_only.begin()));
553 551
554 return !new_hosts_only.empty(); 552 return !new_hosts_only.empty();
555 } 553 }
556 554
557 } // namespace extensions 555 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698