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

Side by Side Diff: components/dom_distiller/core/article_attachments_data.h

Issue 1879613003: Convert //components/dom_distiller from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef COMPONENTS_DOM_DISTILLER_CORE_ARTICLE_ATTACHMENTS_DATA_H_ 5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_ARTICLE_ATTACHMENTS_DATA_H_
6 #define COMPONENTS_DOM_DISTILLER_CORE_ARTICLE_ATTACHMENTS_DATA_H_ 6 #define COMPONENTS_DOM_DISTILLER_CORE_ARTICLE_ATTACHMENTS_DATA_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 10
10 #include "base/memory/scoped_ptr.h"
11 #include "components/dom_distiller/core/proto/distilled_article.pb.h" 11 #include "components/dom_distiller/core/proto/distilled_article.pb.h"
12 #include "sync/api/attachments/attachment.h" 12 #include "sync/api/attachments/attachment.h"
13 #include "sync/protocol/article_specifics.pb.h" 13 #include "sync/protocol/article_specifics.pb.h"
14 14
15 namespace dom_distiller { 15 namespace dom_distiller {
16 16
17 // When stored, article attachments are split into two pieces, the actual data 17 // When stored, article attachments are split into two pieces, the actual data
18 // is stored by a set of ids in some attachment storage. The mapping of what 18 // is stored by a set of ids in some attachment storage. The mapping of what
19 // each id corresponds to is stored in the ArticleEntry's 19 // each id corresponds to is stored in the ArticleEntry's
20 // sync_pb::ArticleAttachments. This class handles splitting into those two 20 // sync_pb::ArticleAttachments. This class handles splitting into those two
21 // pieces (::CreateSyncAttachments) and reconstructing the data from the two 21 // pieces (::CreateSyncAttachments) and reconstructing the data from the two
22 // pieces (::GetFromAttachmentMap and ::GetAttachmentIds). Outside of this 22 // pieces (::GetFromAttachmentMap and ::GetAttachmentIds). Outside of this
23 // class, the structure of sync_pb::ArticleAttachments (the id mapping) should 23 // class, the structure of sync_pb::ArticleAttachments (the id mapping) should
24 // be rather opaque. 24 // be rather opaque.
25 class ArticleAttachmentsData { 25 class ArticleAttachmentsData {
26 public: 26 public:
27 static scoped_ptr<ArticleAttachmentsData> GetFromAttachmentMap( 27 static std::unique_ptr<ArticleAttachmentsData> GetFromAttachmentMap(
28 const sync_pb::ArticleAttachments& attachments_key, 28 const sync_pb::ArticleAttachments& attachments_key,
29 const syncer::AttachmentMap& attachment_map); 29 const syncer::AttachmentMap& attachment_map);
30 30
31 // Creates sync attachments and the sync_pb::ArticleAttachments id map. 31 // Creates sync attachments and the sync_pb::ArticleAttachments id map.
32 void CreateSyncAttachments( 32 void CreateSyncAttachments(
33 syncer::AttachmentList* attachment_list, 33 syncer::AttachmentList* attachment_list,
34 sync_pb::ArticleAttachments* attachments_key) const; 34 sync_pb::ArticleAttachments* attachments_key) const;
35 35
36 const DistilledArticleProto& distilled_article() const { 36 const DistilledArticleProto& distilled_article() const {
37 return distilled_article_; 37 return distilled_article_;
38 } 38 }
39 void set_distilled_article(const DistilledArticleProto& article) { 39 void set_distilled_article(const DistilledArticleProto& article) {
40 distilled_article_ = article; 40 distilled_article_ = article;
41 } 41 }
42 42
43 std::string ToString() const; 43 std::string ToString() const;
44 private: 44 private:
45 DistilledArticleProto distilled_article_; 45 DistilledArticleProto distilled_article_;
46 }; 46 };
47 47
48 syncer::AttachmentIdList GetAttachmentIds( 48 syncer::AttachmentIdList GetAttachmentIds(
49 const sync_pb::ArticleAttachments& attachments); 49 const sync_pb::ArticleAttachments& attachments);
50 50
51 } // namespace dom_distiller 51 } // namespace dom_distiller
52 52
53 #endif // COMPONENTS_DOM_DISTILLER_CORE_ARTICLE_ATTACHMENTS_DATA_H_ 53 #endif // COMPONENTS_DOM_DISTILLER_CORE_ARTICLE_ATTACHMENTS_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698