OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/utility/media_galleries/itunes_library_parser.h" | 5 #include "chrome/utility/media_galleries/itunes_library_parser.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 if (!iapps::ReadString(reader, &value)) | 67 if (!iapps::ReadString(reader, &value)) |
68 break; | 68 break; |
69 GURL url(value); | 69 GURL url(value); |
70 if (!url.SchemeIsFile()) | 70 if (!url.SchemeIsFile()) |
71 break; | 71 break; |
72 url_canon::RawCanonOutputW<1024> decoded_location; | 72 url_canon::RawCanonOutputW<1024> decoded_location; |
73 url_util::DecodeURLEscapeSequences(url.path().c_str() + 1, // Strip /. | 73 url_util::DecodeURLEscapeSequences(url.path().c_str() + 1, // Strip /. |
74 url.path().length() - 1, | 74 url.path().length() - 1, |
75 &decoded_location); | 75 &decoded_location); |
76 #if defined(OS_WIN) | 76 #if defined(OS_WIN) |
77 string16 location(decoded_location.data(), decoded_location.length()); | 77 base::string16 location(decoded_location.data(), |
| 78 decoded_location.length()); |
78 #else | 79 #else |
79 string16 location16(decoded_location.data(), decoded_location.length()); | 80 base::string16 location16(decoded_location.data(), |
| 81 decoded_location.length()); |
80 std::string location = "/" + UTF16ToUTF8(location16); | 82 std::string location = "/" + UTF16ToUTF8(location16); |
81 #endif | 83 #endif |
82 result->location = base::FilePath(location); | 84 result->location = base::FilePath(location); |
83 found_location = true; | 85 found_location = true; |
84 } else if (found_key == "Artist") { | 86 } else if (found_key == "Artist") { |
85 if (found_artist || found_album_artist) | 87 if (found_artist || found_album_artist) |
86 break; | 88 break; |
87 if (!iapps::ReadString(reader, &result->artist)) | 89 if (!iapps::ReadString(reader, &result->artist)) |
88 break; | 90 break; |
89 found_artist = true; | 91 found_artist = true; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 track_found = true; | 180 track_found = true; |
179 } else { | 181 } else { |
180 no_errors = false; | 182 no_errors = false; |
181 } | 183 } |
182 } | 184 } |
183 | 185 |
184 return track_found || no_errors; | 186 return track_found || no_errors; |
185 } | 187 } |
186 | 188 |
187 } // namespace itunes | 189 } // namespace itunes |
OLD | NEW |