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

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: Add missing head file. 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
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.cc ('k') | extensions/common/matcher/url_matcher.cc » ('j') | 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) 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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 return true; 536 return true;
537 537
538 const URLPatternSet& old_list = effective_hosts(); 538 const URLPatternSet& old_list = effective_hosts();
539 const URLPatternSet& new_list = permissions->effective_hosts(); 539 const URLPatternSet& new_list = permissions->effective_hosts();
540 540
541 // TODO(jstritar): This is overly conservative with respect to subdomains. 541 // TODO(jstritar): This is overly conservative with respect to subdomains.
542 // For example, going from *.google.com to www.google.com will be 542 // For example, going from *.google.com to www.google.com will be
543 // considered an elevation, even though it is not (http://crbug.com/65337). 543 // considered an elevation, even though it is not (http://crbug.com/65337).
544 std::set<std::string> new_hosts_set(GetDistinctHosts(new_list, false, false)); 544 std::set<std::string> new_hosts_set(GetDistinctHosts(new_list, false, false));
545 std::set<std::string> old_hosts_set(GetDistinctHosts(old_list, false, false)); 545 std::set<std::string> old_hosts_set(GetDistinctHosts(old_list, false, false));
546 std::set<std::string> new_hosts_only; 546 std::set<std::string> new_hosts_only =
547 547 base::STLSetDifference<std::set<std::string> >(new_hosts_set,
548 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), 548 old_hosts_set);
549 old_hosts_set.begin(), old_hosts_set.end(),
550 std::inserter(new_hosts_only, new_hosts_only.begin()));
551 549
552 return !new_hosts_only.empty(); 550 return !new_hosts_only.empty();
553 } 551 }
554 552
555 } // namespace extensions 553 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.cc ('k') | extensions/common/matcher/url_matcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698