summaryrefslogtreecommitdiffstats
path: root/extensions/common/permissions
diff options
context:
space:
mode:
authorbrettw <brettw@chromium.org>2015-08-06 17:11:28 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-07 00:12:13 +0000
commit0aa7c64253cca8b636d52d1d01d94f96ab9c13fa (patch)
tree29b825a84dffc4d7310c69b22da0cfd7b1228277 /extensions/common/permissions
parent924597ba8b5def174aebdc96368545f51df1bee2 (diff)
downloadchromium_src-0aa7c64253cca8b636d52d1d01d94f96ab9c13fa.zip
chromium_src-0aa7c64253cca8b636d52d1d01d94f96ab9c13fa.tar.gz
chromium_src-0aa7c64253cca8b636d52d1d01d94f96ab9c13fa.tar.bz2
Update SplitString calls to new form
Uses the new form for most (but not quite all) of the remaining users of the old form. Changes media mime util codec list parsing to expect no result from the string "," rather than two empty strings. The old SplitString call had a special case where if the input was empty, it would return empty, but if it had one split character, it would return two empty strings as results. The new one lets you choose but the options are either (1) empty string -> one empty string and "," -> two empty strings, or (2) map both to no results for when you don't want empty results. I'm pretty sure media codec parsing actually wants the latter behavior, so I updated the call to discard empty results and MimeUtilTest.ParseCodecString is updated. Review URL: https://codereview.chromium.org/1272823003 Cr-Commit-Position: refs/heads/master@{#342238}
Diffstat (limited to 'extensions/common/permissions')
-rw-r--r--extensions/common/permissions/socket_permission_data.cc5
-rw-r--r--extensions/common/permissions/socket_permission_entry.cc10
2 files changed, 9 insertions, 6 deletions
diff --git a/extensions/common/permissions/socket_permission_data.cc b/extensions/common/permissions/socket_permission_data.cc
index a01c20f..f22f14a 100644
--- a/extensions/common/permissions/socket_permission_data.cc
+++ b/extensions/common/permissions/socket_permission_data.cc
@@ -124,8 +124,9 @@ SocketPermissionEntry& SocketPermissionData::entry() {
bool SocketPermissionData::Parse(const std::string& permission) {
Reset();
- std::vector<std::string> tokens;
- base::SplitStringDontTrim(permission, kColon, &tokens);
+ std::vector<std::string> tokens =
+ base::SplitString(permission, std::string(1, kColon),
+ base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);
if (tokens.empty())
return false;
diff --git a/extensions/common/permissions/socket_permission_entry.cc b/extensions/common/permissions/socket_permission_entry.cc
index 8b2d355..86c61de 100644
--- a/extensions/common/permissions/socket_permission_entry.cc
+++ b/extensions/common/permissions/socket_permission_entry.cc
@@ -128,8 +128,9 @@ bool SocketPermissionEntry::ParseHostPattern(
SocketPermissionRequest::OperationType type,
const std::string& pattern,
SocketPermissionEntry* entry) {
- std::vector<std::string> tokens;
- base::SplitStringDontTrim(pattern, kColon, &tokens);
+ std::vector<std::string> tokens =
+ base::SplitString(pattern, std::string(1, kColon), base::KEEP_WHITESPACE,
+ base::SPLIT_WANT_ALL);
return ParseHostPattern(type, tokens, entry);
}
@@ -168,8 +169,9 @@ bool SocketPermissionEntry::ParseHostPattern(
result.pattern_.host = base::StringToLowerASCII(result.pattern_.host);
// The first component can optionally be '*' to match all subdomains.
- std::vector<std::string> host_components;
- base::SplitString(result.pattern_.host, kDot, &host_components);
+ std::vector<std::string> host_components =
+ base::SplitString(result.pattern_.host, std::string(1, kDot),
+ base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
DCHECK(!host_components.empty());
if (host_components[0] == kWildcard || host_components[0].empty()) {