OLD | NEW |
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 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 entry->content_.url_ = file.web_content_link(); | 818 entry->content_.url_ = file.web_content_link(); |
819 entry->content_.mime_type_ = file.mime_type(); | 819 entry->content_.mime_type_ = file.mime_type(); |
820 // TODO(kochi): entry->feed_links_ | 820 // TODO(kochi): entry->feed_links_ |
821 | 821 |
822 // For file entries | 822 // For file entries |
823 entry->filename_ = UTF8ToUTF16(file.title()); | 823 entry->filename_ = UTF8ToUTF16(file.title()); |
824 entry->suggested_filename_ = UTF8ToUTF16(file.title()); | 824 entry->suggested_filename_ = UTF8ToUTF16(file.title()); |
825 entry->file_md5_ = file.md5_checksum(); | 825 entry->file_md5_ = file.md5_checksum(); |
826 entry->file_size_ = file.file_size(); | 826 entry->file_size_ = file.file_size(); |
827 | 827 |
828 entry->deleted_ = false; // later filled by CreateFromChangeResource. | 828 // If file is removed completely, that information is only available in |
829 entry->removed_ = false; // later filled by CreateFromChangeResource. | 829 // ChangeResource, and is reflected in |removed_|. If file is trashed, the |
| 830 // file entry still exists but with its "trashed" label true. |
| 831 entry->deleted_ = file.labels().is_trashed(); |
830 | 832 |
831 // FeedEntry | 833 // FeedEntry |
832 entry->etag_ = file.etag(); | 834 entry->etag_ = file.etag(); |
833 // entry->authors_ | 835 // entry->authors_ |
834 // entry->links_. | 836 // entry->links_. |
835 if (!file.parents().empty()) { | 837 if (!file.parents().empty()) { |
836 Link* link = new Link(); | 838 Link* link = new Link(); |
837 link->type_ = Link::PARENT; | 839 link->type_ = Link::PARENT; |
838 link->href_ = file.parents()[0]->parent_link(); | 840 link->href_ = file.parents()[0]->parent_link(); |
839 entry->links_.push_back(link); | 841 entry->links_.push_back(link); |
(...skipping 28 matching lines...) Expand all Loading... |
868 // TODO: Do we need this? | 870 // TODO: Do we need this? |
869 entry->FillRemainingFields(); | 871 entry->FillRemainingFields(); |
870 return entry.release(); | 872 return entry.release(); |
871 } | 873 } |
872 | 874 |
873 // static | 875 // static |
874 DocumentEntry* | 876 DocumentEntry* |
875 DocumentEntry::CreateFromChangeResource(const ChangeResource& change) { | 877 DocumentEntry::CreateFromChangeResource(const ChangeResource& change) { |
876 DocumentEntry* entry = CreateFromFileResource(change.file()); | 878 DocumentEntry* entry = CreateFromFileResource(change.file()); |
877 | 879 |
878 entry->deleted_ = change.is_deleted(); | 880 // If |is_deleted()| returns true, the file is removed from Drive. |
879 entry->removed_ = change.is_deleted(); | 881 entry->removed_ = change.is_deleted(); |
880 | 882 |
881 return entry; | 883 return entry; |
882 } | 884 } |
883 | 885 |
884 // static | 886 // static |
885 std::string DocumentEntry::GetEntryNodeName() { | 887 std::string DocumentEntry::GetEntryNodeName() { |
886 return kEntryNode; | 888 return kEntryNode; |
887 } | 889 } |
888 | 890 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 bool AccountMetadataFeed::Parse(const base::Value& value) { | 1118 bool AccountMetadataFeed::Parse(const base::Value& value) { |
1117 base::JSONValueConverter<AccountMetadataFeed> converter; | 1119 base::JSONValueConverter<AccountMetadataFeed> converter; |
1118 if (!converter.Convert(value, this)) { | 1120 if (!converter.Convert(value, this)) { |
1119 LOG(ERROR) << "Unable to parse: Invalid account metadata feed!"; | 1121 LOG(ERROR) << "Unable to parse: Invalid account metadata feed!"; |
1120 return false; | 1122 return false; |
1121 } | 1123 } |
1122 return true; | 1124 return true; |
1123 } | 1125 } |
1124 | 1126 |
1125 } // namespace gdata | 1127 } // namespace gdata |
OLD | NEW |