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

Side by Side Diff: webkit/browser/appcache/manifest_parser.cc

Issue 121123002: Update uses of UTF conversions in ppapi/, printing/, remoting/, rlz/, sandbox/, skia/, sql/, sync/,… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This is a port of ManifestParser.cc from WebKit/WebCore/loader/appcache. 5 // This is a port of ManifestParser.cc from WebKit/WebCore/loader/appcache.
6 6
7 /* 7 /*
8 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 8 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 continue; 180 continue;
181 } else if (mode == EXPLICIT || mode == ONLINE_WHITELIST) { 181 } else if (mode == EXPLICIT || mode == ONLINE_WHITELIST) {
182 const wchar_t *line_p = line.c_str(); 182 const wchar_t *line_p = line.c_str();
183 const wchar_t *line_end = line_p + line.length(); 183 const wchar_t *line_end = line_p + line.length();
184 184
185 // Look for whitespace separating the URL from subsequent ignored tokens. 185 // Look for whitespace separating the URL from subsequent ignored tokens.
186 while (line_p < line_end && *line_p != '\t' && *line_p != ' ') 186 while (line_p < line_end && *line_p != '\t' && *line_p != ' ')
187 ++line_p; 187 ++line_p;
188 188
189 base::string16 url16; 189 base::string16 url16;
190 WideToUTF16(line.c_str(), line_p - line.c_str(), &url16); 190 base::WideToUTF16(line.c_str(), line_p - line.c_str(), &url16);
191 GURL url = manifest_url.Resolve(url16); 191 GURL url = manifest_url.Resolve(url16);
192 if (!url.is_valid()) 192 if (!url.is_valid())
193 continue; 193 continue;
194 if (url.has_ref()) { 194 if (url.has_ref()) {
195 GURL::Replacements replacements; 195 GURL::Replacements replacements;
196 replacements.ClearRef(); 196 replacements.ClearRef();
197 url = url.ReplaceComponents(replacements); 197 url = url.ReplaceComponents(replacements);
198 } 198 }
199 199
200 // Scheme component must be the same as the manifest URL's. 200 // Scheme component must be the same as the manifest URL's.
(...skipping 24 matching lines...) Expand all
225 225
226 // Look for first whitespace separating the url namespace from 226 // Look for first whitespace separating the url namespace from
227 // the intercept type. 227 // the intercept type.
228 while (line_p < line_end && *line_p != '\t' && *line_p != ' ') 228 while (line_p < line_end && *line_p != '\t' && *line_p != ' ')
229 ++line_p; 229 ++line_p;
230 230
231 if (line_p == line_end) 231 if (line_p == line_end)
232 continue; // There was no whitespace separating the URLs. 232 continue; // There was no whitespace separating the URLs.
233 233
234 base::string16 namespace_url16; 234 base::string16 namespace_url16;
235 WideToUTF16(line.c_str(), line_p - line.c_str(), &namespace_url16); 235 base::WideToUTF16(line.c_str(), line_p - line.c_str(), &namespace_url16);
236 GURL namespace_url = manifest_url.Resolve(namespace_url16); 236 GURL namespace_url = manifest_url.Resolve(namespace_url16);
237 if (!namespace_url.is_valid()) 237 if (!namespace_url.is_valid())
238 continue; 238 continue;
239 if (namespace_url.has_ref()) { 239 if (namespace_url.has_ref()) {
240 GURL::Replacements replacements; 240 GURL::Replacements replacements;
241 replacements.ClearRef(); 241 replacements.ClearRef();
242 namespace_url = namespace_url.ReplaceComponents(replacements); 242 namespace_url = namespace_url.ReplaceComponents(replacements);
243 } 243 }
244 244
245 // The namespace URL must have the same scheme, host and port 245 // The namespace URL must have the same scheme, host and port
(...skipping 26 matching lines...) Expand all
272 // Skip whitespace separating type from the target_url. 272 // Skip whitespace separating type from the target_url.
273 while (line_p < line_end && (*line_p == '\t' || *line_p == ' ')) 273 while (line_p < line_end && (*line_p == '\t' || *line_p == ' '))
274 ++line_p; 274 ++line_p;
275 275
276 // Look for whitespace separating the URL from subsequent ignored tokens. 276 // Look for whitespace separating the URL from subsequent ignored tokens.
277 const wchar_t* target_url_start = line_p; 277 const wchar_t* target_url_start = line_p;
278 while (line_p < line_end && *line_p != '\t' && *line_p != ' ') 278 while (line_p < line_end && *line_p != '\t' && *line_p != ' ')
279 ++line_p; 279 ++line_p;
280 280
281 base::string16 target_url16; 281 base::string16 target_url16;
282 WideToUTF16(target_url_start, line_p - target_url_start, &target_url16); 282 base::WideToUTF16(target_url_start, line_p - target_url_start,
283 &target_url16);
283 GURL target_url = manifest_url.Resolve(target_url16); 284 GURL target_url = manifest_url.Resolve(target_url16);
284 if (!target_url.is_valid()) 285 if (!target_url.is_valid())
285 continue; 286 continue;
286 287
287 if (target_url.has_ref()) { 288 if (target_url.has_ref()) {
288 GURL::Replacements replacements; 289 GURL::Replacements replacements;
289 replacements.ClearRef(); 290 replacements.ClearRef();
290 target_url = target_url.ReplaceComponents(replacements); 291 target_url = target_url.ReplaceComponents(replacements);
291 } 292 }
292 if (manifest_url.GetOrigin() != target_url.GetOrigin()) 293 if (manifest_url.GetOrigin() != target_url.GetOrigin())
(...skipping 10 matching lines...) Expand all
303 // Look for whitespace separating the two URLs 304 // Look for whitespace separating the two URLs
304 while (line_p < line_end && *line_p != '\t' && *line_p != ' ') 305 while (line_p < line_end && *line_p != '\t' && *line_p != ' ')
305 ++line_p; 306 ++line_p;
306 307
307 if (line_p == line_end) { 308 if (line_p == line_end) {
308 // There was no whitespace separating the URLs. 309 // There was no whitespace separating the URLs.
309 continue; 310 continue;
310 } 311 }
311 312
312 base::string16 namespace_url16; 313 base::string16 namespace_url16;
313 WideToUTF16(line.c_str(), line_p - line.c_str(), &namespace_url16); 314 base::WideToUTF16(line.c_str(), line_p - line.c_str(), &namespace_url16);
314 GURL namespace_url = manifest_url.Resolve(namespace_url16); 315 GURL namespace_url = manifest_url.Resolve(namespace_url16);
315 if (!namespace_url.is_valid()) 316 if (!namespace_url.is_valid())
316 continue; 317 continue;
317 if (namespace_url.has_ref()) { 318 if (namespace_url.has_ref()) {
318 GURL::Replacements replacements; 319 GURL::Replacements replacements;
319 replacements.ClearRef(); 320 replacements.ClearRef();
320 namespace_url = namespace_url.ReplaceComponents(replacements); 321 namespace_url = namespace_url.ReplaceComponents(replacements);
321 } 322 }
322 323
323 // Fallback namespace URL must have the same scheme, host and port 324 // Fallback namespace URL must have the same scheme, host and port
324 // as the manifest's URL. 325 // as the manifest's URL.
325 if (manifest_url.GetOrigin() != namespace_url.GetOrigin()) { 326 if (manifest_url.GetOrigin() != namespace_url.GetOrigin()) {
326 continue; 327 continue;
327 } 328 }
328 329
329 // Skip whitespace separating fallback namespace from URL. 330 // Skip whitespace separating fallback namespace from URL.
330 while (line_p < line_end && (*line_p == '\t' || *line_p == ' ')) 331 while (line_p < line_end && (*line_p == '\t' || *line_p == ' '))
331 ++line_p; 332 ++line_p;
332 333
333 // Look for whitespace separating the URL from subsequent ignored tokens. 334 // Look for whitespace separating the URL from subsequent ignored tokens.
334 const wchar_t* fallback_start = line_p; 335 const wchar_t* fallback_start = line_p;
335 while (line_p < line_end && *line_p != '\t' && *line_p != ' ') 336 while (line_p < line_end && *line_p != '\t' && *line_p != ' ')
336 ++line_p; 337 ++line_p;
337 338
338 base::string16 fallback_url16; 339 base::string16 fallback_url16;
339 WideToUTF16(fallback_start, line_p - fallback_start, &fallback_url16); 340 base::WideToUTF16(fallback_start, line_p - fallback_start,
341 &fallback_url16);
340 GURL fallback_url = manifest_url.Resolve(fallback_url16); 342 GURL fallback_url = manifest_url.Resolve(fallback_url16);
341 if (!fallback_url.is_valid()) 343 if (!fallback_url.is_valid())
342 continue; 344 continue;
343 if (fallback_url.has_ref()) { 345 if (fallback_url.has_ref()) {
344 GURL::Replacements replacements; 346 GURL::Replacements replacements;
345 replacements.ClearRef(); 347 replacements.ClearRef();
346 fallback_url = fallback_url.ReplaceComponents(replacements); 348 fallback_url = fallback_url.ReplaceComponents(replacements);
347 } 349 }
348 350
349 // Fallback entry URL must have the same scheme, host and port 351 // Fallback entry URL must have the same scheme, host and port
(...skipping 11 matching lines...) Expand all
361 fallback_url, is_pattern)); 363 fallback_url, is_pattern));
362 } else { 364 } else {
363 NOTREACHED(); 365 NOTREACHED();
364 } 366 }
365 } 367 }
366 368
367 return true; 369 return true;
368 } 370 }
369 371
370 } // namespace appcache 372 } // namespace appcache
OLDNEW
« no previous file with comments | « tools/memory_watcher/memory_watcher.cc ('k') | webkit/browser/appcache/view_appcache_internals_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698