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

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

Issue 120593003: Move kFileScheme constant into content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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_message_util.h" 5 #include "chrome/common/extensions/permissions/permission_message_util.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "content/public/common/url_constants.h" 9 #include "content/public/common/url_constants.h"
10 #include "extensions/common/permissions/permission_message.h" 10 #include "extensions/common/permissions/permission_message.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 const URLPatternSet& host_patterns, 96 const URLPatternSet& host_patterns,
97 bool include_rcd, 97 bool include_rcd,
98 bool exclude_file_scheme) { 98 bool exclude_file_scheme) {
99 // Use a vector to preserve order (also faster than a map on small sets). 99 // Use a vector to preserve order (also faster than a map on small sets).
100 // Each item is a host split into two parts: host without RCDs and 100 // Each item is a host split into two parts: host without RCDs and
101 // current best RCD. 101 // current best RCD.
102 typedef std::vector<std::pair<std::string, std::string> > HostVector; 102 typedef std::vector<std::pair<std::string, std::string> > HostVector;
103 HostVector hosts_best_rcd; 103 HostVector hosts_best_rcd;
104 for (URLPatternSet::const_iterator i = host_patterns.begin(); 104 for (URLPatternSet::const_iterator i = host_patterns.begin();
105 i != host_patterns.end(); ++i) { 105 i != host_patterns.end(); ++i) {
106 if (exclude_file_scheme && i->scheme() == chrome::kFileScheme) 106 if (exclude_file_scheme && i->scheme() == content::kFileScheme)
107 continue; 107 continue;
108 108
109 std::string host = i->host(); 109 std::string host = i->host();
110 110
111 // Add the subdomain wildcard back to the host, if necessary. 111 // Add the subdomain wildcard back to the host, if necessary.
112 if (i->match_subdomains()) 112 if (i->match_subdomains())
113 host = "*." + host; 113 host = "*." + host;
114 114
115 // If the host has an RCD, split it off so we can detect duplicates. 115 // If the host has an RCD, split it off so we can detect duplicates.
116 std::string rcd; 116 std::string rcd;
(...skipping 24 matching lines...) Expand all
141 141
142 // Build up the final vector by concatenating hosts and RCDs. 142 // Build up the final vector by concatenating hosts and RCDs.
143 std::set<std::string> distinct_hosts; 143 std::set<std::string> distinct_hosts;
144 for (HostVector::iterator it = hosts_best_rcd.begin(); 144 for (HostVector::iterator it = hosts_best_rcd.begin();
145 it != hosts_best_rcd.end(); ++it) 145 it != hosts_best_rcd.end(); ++it)
146 distinct_hosts.insert(it->first + it->second); 146 distinct_hosts.insert(it->first + it->second);
147 return distinct_hosts; 147 return distinct_hosts;
148 } 148 }
149 149
150 } // namespace permission_message_util 150 } // namespace permission_message_util
OLDNEW
« no previous file with comments | « chrome/common/extensions/manifest_handlers/content_scripts_handler.cc ('k') | chrome/common/net/url_fixer_upper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698