| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 |
| 11 #include "base/base64.h" |
| 11 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 12 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 13 #include "net/base/base64.h" | |
| 14 #include "net/base/escape.h" | 14 #include "net/base/escape.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 // static | 18 // static |
| 19 bool DataURL::Parse(const GURL& url, std::string* mime_type, | 19 bool DataURL::Parse(const GURL& url, std::string* mime_type, |
| 20 std::string* charset, std::string* data) { | 20 std::string* charset, std::string* data) { |
| 21 std::string::const_iterator begin = url.spec().begin(); | 21 std::string::const_iterator begin = url.spec().begin(); |
| 22 std::string::const_iterator end = url.spec().end(); | 22 std::string::const_iterator end = url.spec().end(); |
| 23 | 23 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 temp_data.end()); | 86 temp_data.end()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 if (!base64_encoded) { | 89 if (!base64_encoded) { |
| 90 temp_data = UnescapeURLComponent(temp_data, | 90 temp_data = UnescapeURLComponent(temp_data, |
| 91 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS | | 91 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS | |
| 92 UnescapeRule::CONTROL_CHARS); | 92 UnescapeRule::CONTROL_CHARS); |
| 93 } | 93 } |
| 94 | 94 |
| 95 if (base64_encoded) | 95 if (base64_encoded) |
| 96 return Base64Decode(temp_data, data); | 96 return base::Base64Decode(temp_data, data); |
| 97 | 97 |
| 98 temp_data.swap(*data); | 98 temp_data.swap(*data); |
| 99 return true; | 99 return true; |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // namespace net | 102 } // namespace net |
| OLD | NEW |