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

Side by Side Diff: net/base/data_url.cc

Issue 448853002: Move StringToLowerASCII to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « gpu/config/gpu_control_list.cc ('k') | net/base/filename_util_internal.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 (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 // NOTE: based loosely on mozilla's nsDataChannel.cpp 5 // NOTE: based loosely on mozilla's nsDataChannel.cpp
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "net/base/data_url.h" 9 #include "net/base/data_url.h"
10 10
(...skipping 24 matching lines...) Expand all
35 if (comma == end) 35 if (comma == end)
36 return false; 36 return false;
37 37
38 std::vector<std::string> meta_data; 38 std::vector<std::string> meta_data;
39 std::string unparsed_meta_data(after_colon, comma); 39 std::string unparsed_meta_data(after_colon, comma);
40 base::SplitString(unparsed_meta_data, ';', &meta_data); 40 base::SplitString(unparsed_meta_data, ';', &meta_data);
41 41
42 std::vector<std::string>::iterator iter = meta_data.begin(); 42 std::vector<std::string>::iterator iter = meta_data.begin();
43 if (iter != meta_data.end()) { 43 if (iter != meta_data.end()) {
44 mime_type->swap(*iter); 44 mime_type->swap(*iter);
45 StringToLowerASCII(mime_type); 45 base::StringToLowerASCII(mime_type);
46 ++iter; 46 ++iter;
47 } 47 }
48 48
49 static const char kBase64Tag[] = "base64"; 49 static const char kBase64Tag[] = "base64";
50 static const char kCharsetTag[] = "charset="; 50 static const char kCharsetTag[] = "charset=";
51 const size_t kCharsetTagLength = arraysize(kCharsetTag) - 1; 51 const size_t kCharsetTagLength = arraysize(kCharsetTag) - 1;
52 52
53 bool base64_encoded = false; 53 bool base64_encoded = false;
54 for (; iter != meta_data.end(); ++iter) { 54 for (; iter != meta_data.end(); ++iter) {
55 if (!base64_encoded && *iter == kBase64Tag) { 55 if (!base64_encoded && *iter == kBase64Tag) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 temp_data.resize(length + padding_needed, '='); 118 temp_data.resize(length + padding_needed, '=');
119 } 119 }
120 return base::Base64Decode(temp_data, data); 120 return base::Base64Decode(temp_data, data);
121 } 121 }
122 122
123 temp_data.swap(*data); 123 temp_data.swap(*data);
124 return true; 124 return true;
125 } 125 }
126 126
127 } // namespace net 127 } // namespace net
OLDNEW
« no previous file with comments | « gpu/config/gpu_control_list.cc ('k') | net/base/filename_util_internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698