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

Unified Diff: ios/chrome/browser/reading_list/reading_list_model_storage_defaults.mm

Issue 2491383002: Use Distilled path instead of DistilledURL. (Closed)
Patch Set: fix compilation 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/reading_list/reading_list_model_storage_defaults.mm
diff --git a/ios/chrome/browser/reading_list/reading_list_model_storage_defaults.mm b/ios/chrome/browser/reading_list/reading_list_model_storage_defaults.mm
index 993b5d5d1803395d841597385e6c0efb4e8a38d8..9b683425ab52fa9ed3aa26717ca6415ec17f352a 100644
--- a/ios/chrome/browser/reading_list/reading_list_model_storage_defaults.mm
+++ b/ios/chrome/browser/reading_list/reading_list_model_storage_defaults.mm
@@ -17,7 +17,7 @@ NSString* const kReadingListUnreadElements = @"ReadingListUnreadElements";
NSString* const kReadingListEntryTitleKey = @"title";
NSString* const kReadingListEntryURLKey = @"URL";
NSString* const kReadingListEntryStateKey = @"state";
-NSString* const kReadingListEntryDistilledURLKey = @"distilledURL";
+NSString* const kReadingListEntryDistilledPathKey = @"distilledPath";
ReadingListEntry DecodeReadingListEntry(NSData* data) {
NSError* error = nil;
@@ -36,12 +36,13 @@ ReadingListEntry DecodeReadingListEntry(NSData* data) {
switch (state) {
case ReadingListEntry::PROCESSED: {
- NSURL* distilled_url = base::mac::ObjCCastStrict<NSURL>(
- [dictionary objectForKey:kReadingListEntryDistilledURLKey]);
- DCHECK(distilled_url);
- GURL distilled_gurl(net::GURLWithNSURL(distilled_url));
- DCHECK(distilled_gurl.is_valid());
- entry.SetDistilledURL(distilled_gurl);
+ NSString* distilled_path = base::mac::ObjCCastStrict<NSString>(
+ [dictionary objectForKey:kReadingListEntryDistilledPathKey]);
+ if (distilled_path) {
+ base::FilePath path =
+ base::FilePath(base::SysNSStringToUTF8(distilled_path));
+ entry.SetDistilledPath(path);
+ }
break;
}
case ReadingListEntry::PROCESSING:
@@ -65,12 +66,12 @@ NSData* EncodeReadingListEntry(const ReadingListEntry& entry) {
[NSNumber numberWithInt:entry.DistilledState()]
}];
- const GURL distilled_gurl(entry.DistilledURL());
- if (distilled_gurl.is_valid()) {
- NSURL* distilled_url = net::NSURLWithGURL(distilled_gurl);
- if (distilled_url)
- [dictionary setObject:distilled_url
- forKey:kReadingListEntryDistilledURLKey];
+ const base::FilePath path(entry.DistilledPath());
+ if (!path.empty()) {
+ NSString* distilled_path = base::SysUTF8ToNSString(path.value());
+ if (distilled_path)
+ [dictionary setObject:distilled_path
+ forKey:kReadingListEntryDistilledPathKey];
}
return [NSKeyedArchiver archivedDataWithRootObject:dictionary];
}

Powered by Google App Engine
This is Rietveld 408576698