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

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

Issue 11312228: Move extension_error_utils.* and url_pattern_set.* into (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: hate Created 8 years, 1 month 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
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_set.h"
14 #include "content/public/common/url_constants.h" 13 #include "content/public/common/url_constants.h"
15 #include "extensions/common/url_pattern.h" 14 #include "extensions/common/url_pattern.h"
15 #include "extensions/common/url_pattern_set.h"
16 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
17 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 17 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
18 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
19 19
20 using extensions::URLPatternSet;
21
20 namespace { 22 namespace {
21 23
22 // Helper for GetDistinctHosts(): com > net > org > everything else. 24 // Helper for GetDistinctHosts(): com > net > org > everything else.
23 bool RcdBetterThan(const std::string& a, const std::string& b) { 25 bool RcdBetterThan(const std::string& a, const std::string& b) {
24 if (a == b) 26 if (a == b)
25 return false; 27 return false;
26 if (a == "com") 28 if (a == "com")
27 return true; 29 return true;
28 if (a == "net") 30 if (a == "net")
29 return b != "com"; 31 return b != "com";
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 std::set<std::string> new_hosts_only; 589 std::set<std::string> new_hosts_only;
588 590
589 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), 591 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(),
590 old_hosts_set.begin(), old_hosts_set.end(), 592 old_hosts_set.begin(), old_hosts_set.end(),
591 std::inserter(new_hosts_only, new_hosts_only.begin())); 593 std::inserter(new_hosts_only, new_hosts_only.begin()));
592 594
593 return !new_hosts_only.empty(); 595 return !new_hosts_only.empty();
594 } 596 }
595 597
596 } // namespace extensions 598 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/permissions/permission_set.h ('k') | chrome/common/extensions/permissions/permission_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698