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

Side by Side Diff: extensions/common/permissions/socket_permission_data.cc

Issue 1274123003: Update SplitString calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no media changes Created 5 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 | « extensions/common/manifest.cc ('k') | extensions/common/permissions/socket_permission_entry.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/common/permissions/socket_permission_data.h" 5 #include "extensions/common/permissions/socket_permission_data.h"
6 6
7 #include <cstdlib> 7 #include <cstdlib>
8 #include <sstream> 8 #include <sstream>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 SocketPermissionEntry& SocketPermissionData::entry() { 117 SocketPermissionEntry& SocketPermissionData::entry() {
118 // Clear the spec because the caller could mutate |this|. 118 // Clear the spec because the caller could mutate |this|.
119 spec_.clear(); 119 spec_.clear();
120 return entry_; 120 return entry_;
121 } 121 }
122 122
123 // TODO(reillyg): Rewrite this method to support IPv6. 123 // TODO(reillyg): Rewrite this method to support IPv6.
124 bool SocketPermissionData::Parse(const std::string& permission) { 124 bool SocketPermissionData::Parse(const std::string& permission) {
125 Reset(); 125 Reset();
126 126
127 std::vector<std::string> tokens; 127 std::vector<std::string> tokens =
128 base::SplitStringDontTrim(permission, kColon, &tokens); 128 base::SplitString(permission, std::string(1, kColon),
129 base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);
129 if (tokens.empty()) 130 if (tokens.empty())
130 return false; 131 return false;
131 132
132 SocketPermissionRequest::OperationType type = StringToType(tokens[0]); 133 SocketPermissionRequest::OperationType type = StringToType(tokens[0]);
133 if (type == SocketPermissionRequest::NONE) 134 if (type == SocketPermissionRequest::NONE)
134 return false; 135 return false;
135 136
136 tokens.erase(tokens.begin()); 137 tokens.erase(tokens.begin());
137 return SocketPermissionEntry::ParseHostPattern(type, tokens, &entry_); 138 return SocketPermissionEntry::ParseHostPattern(type, tokens, &entry_);
138 } 139 }
(...skipping 10 matching lines...) Expand all
149 } 150 }
150 return spec_; 151 return spec_;
151 } 152 }
152 153
153 void SocketPermissionData::Reset() { 154 void SocketPermissionData::Reset() {
154 entry_ = SocketPermissionEntry(); 155 entry_ = SocketPermissionEntry();
155 spec_.clear(); 156 spec_.clear();
156 } 157 }
157 158
158 } // namespace extensions 159 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/manifest.cc ('k') | extensions/common/permissions/socket_permission_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698