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 "components/dom_distiller/core/article_entry.h" | 5 #include "components/dom_distiller/core/article_entry.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "components/dom_distiller/core/article_attachments_data.h" |
8 #include "sync/api/sync_change.h" | 9 #include "sync/api/sync_change.h" |
9 | 10 |
10 using sync_pb::EntitySpecifics; | 11 using sync_pb::EntitySpecifics; |
11 using sync_pb::ArticlePage; | 12 using sync_pb::ArticlePage; |
12 using sync_pb::ArticleSpecifics; | 13 using sync_pb::ArticleSpecifics; |
13 | 14 |
14 namespace dom_distiller { | 15 namespace dom_distiller { |
15 | 16 |
16 bool IsEntryPageValid(const ArticleEntryPage& page) { return page.has_url(); } | 17 bool IsEntryPageValid(const ArticleEntryPage& page) { return page.has_url(); } |
17 | 18 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 const EntitySpecifics& entity = data.GetSpecifics(); | 57 const EntitySpecifics& entity = data.GetSpecifics(); |
57 DCHECK(entity.has_article()); | 58 DCHECK(entity.has_article()); |
58 const ArticleSpecifics& specifics = entity.article(); | 59 const ArticleSpecifics& specifics = entity.article(); |
59 DCHECK(specifics.has_entry_id()); | 60 DCHECK(specifics.has_entry_id()); |
60 return specifics.entry_id(); | 61 return specifics.entry_id(); |
61 } | 62 } |
62 | 63 |
63 syncer::SyncData CreateLocalData(const ArticleEntry& entry) { | 64 syncer::SyncData CreateLocalData(const ArticleEntry& entry) { |
64 EntitySpecifics specifics = SpecificsFromEntry(entry); | 65 EntitySpecifics specifics = SpecificsFromEntry(entry); |
65 const std::string& entry_id = entry.entry_id(); | 66 const std::string& entry_id = entry.entry_id(); |
66 return syncer::SyncData::CreateLocalData(entry_id, entry_id, specifics); | 67 return syncer::SyncData::CreateLocalDataWithAttachments( |
| 68 entry_id, entry_id, specifics, GetAttachmentIds(entry.attachments())); |
67 } | 69 } |
68 | 70 |
69 } // namespace dom_distiller | 71 } // namespace dom_distiller |
OLD | NEW |