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

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

Issue 10765014: [Coverity] Fix pass-by-val/pass-by-ref (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | « no previous file | 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/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
11 #include "chrome/common/extensions/extension.h" 11 #include "chrome/common/extensions/extension.h"
12 #include "chrome/common/extensions/permissions/permissions_info.h" 12 #include "chrome/common/extensions/permissions/permissions_info.h"
13 #include "chrome/common/extensions/url_pattern.h" 13 #include "chrome/common/extensions/url_pattern.h"
14 #include "chrome/common/extensions/url_pattern_set.h" 14 #include "chrome/common/extensions/url_pattern_set.h"
15 #include "content/public/common/url_constants.h" 15 #include "content/public/common/url_constants.h"
16 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
17 #include "net/base/registry_controlled_domain.h" 17 #include "net/base/registry_controlled_domain.h"
18 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
19 19
20 namespace { 20 namespace {
21 21
22 // Helper for GetDistinctHosts(): com > net > org > everything else. 22 // Helper for GetDistinctHosts(): com > net > org > everything else.
23 bool RcdBetterThan(std::string a, std::string b) { 23 bool RcdBetterThan(const std::string& a, const std::string& b) {
24 if (a == b) 24 if (a == b)
25 return false; 25 return false;
26 if (a == "com") 26 if (a == "com")
27 return true; 27 return true;
28 if (a == "net") 28 if (a == "net")
29 return b != "com"; 29 return b != "com";
30 if (a == "org") 30 if (a == "org")
31 return b != "com" && b != "net"; 31 return b != "com" && b != "net";
32 return false; 32 return false;
33 } 33 }
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 std::set<std::string> new_hosts_only; 578 std::set<std::string> new_hosts_only;
579 579
580 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), 580 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(),
581 old_hosts_set.begin(), old_hosts_set.end(), 581 old_hosts_set.begin(), old_hosts_set.end(),
582 std::inserter(new_hosts_only, new_hosts_only.begin())); 582 std::inserter(new_hosts_only, new_hosts_only.begin()));
583 583
584 return !new_hosts_only.empty(); 584 return !new_hosts_only.empty();
585 } 585 }
586 586
587 } // namespace extensions 587 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698