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

Side by Side Diff: chrome/utility/media_galleries/itunes_library_parser.cc

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 years, 1 month 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
OLDNEW
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 if (key == "Track ID") { 44 if (key == "Track ID") {
45 return iapps::ReadInteger(reader_, &track_info_->id); 45 return iapps::ReadInteger(reader_, &track_info_->id);
46 } else if (key == "Location") { 46 } else if (key == "Location") {
47 std::string value; 47 std::string value;
48 if (!iapps::ReadString(reader_, &value)) 48 if (!iapps::ReadString(reader_, &value))
49 return false; 49 return false;
50 GURL url(value); 50 GURL url(value);
51 if (!url.SchemeIsFile()) 51 if (!url.SchemeIsFile())
52 return false; 52 return false;
53 url::RawCanonOutputW<1024> decoded_location; 53 url::RawCanonOutputW<1024> decoded_location;
54 url::DecodeURLEscapeSequences(url.path().c_str() + 1, // Strip /. 54 url::DecodeURLEscapeSequences(
55 url.path().length() - 1, 55 url.path().as_string().c_str() + 1, // Strip /.
56 &decoded_location); 56 url.path().as_string().length() - 1, &decoded_location);
57 #if defined(OS_WIN) 57 #if defined(OS_WIN)
58 base::string16 location(decoded_location.data(), 58 base::string16 location(decoded_location.data(),
59 decoded_location.length()); 59 decoded_location.length());
60 #else 60 #else
61 base::string16 location16(decoded_location.data(), 61 base::string16 location16(decoded_location.data(),
62 decoded_location.length()); 62 decoded_location.length());
63 std::string location = "/" + base::UTF16ToUTF8(location16); 63 std::string location = "/" + base::UTF16ToUTF8(location16);
64 #endif 64 #endif
65 track_info_->location = base::FilePath(location); 65 track_info_->location = base::FilePath(location);
66 } else if (key == "Artist") { 66 } else if (key == "Artist") {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 track_found = true; 156 track_found = true;
157 } else { 157 } else {
158 no_errors = false; 158 no_errors = false;
159 } 159 }
160 } 160 }
161 161
162 return track_found || no_errors; 162 return track_found || no_errors;
163 } 163 }
164 164
165 } // namespace itunes 165 } // namespace itunes
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/net/websocket.cc ('k') | components/arc/intent_helper/intent_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698