OLD | NEW |
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_DISTILLATION_UPDATE_H_ | 5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_ARTICLE_DISTILLATION_UPDATE_H_ |
6 #define COMPONENTS_DOM_DISTILLER_CORE_ARTICLE_DISTILLATION_UPDATE_H_ | 6 #define COMPONENTS_DOM_DISTILLER_CORE_ARTICLE_DISTILLATION_UPDATE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "components/dom_distiller/core/proto/distilled_page.pb.h" | 13 #include "components/dom_distiller/core/proto/distilled_page.pb.h" |
14 | 14 |
15 namespace dom_distiller { | 15 namespace dom_distiller { |
16 | 16 |
17 // Update about an article that is currently under distillation. | 17 // Update about an article that is currently under distillation. |
18 class ArticleDistillationUpdate { | 18 class ArticleDistillationUpdate { |
19 public: | 19 public: |
20 typedef base::RefCountedData<DistilledPageProto> RefCountedPageProto; | 20 typedef base::RefCountedData<DistilledPageProto> RefCountedPageProto; |
21 | 21 |
22 ArticleDistillationUpdate( | 22 ArticleDistillationUpdate( |
23 const std::vector<scoped_refptr<RefCountedPageProto> >& pages, | 23 const std::vector<scoped_refptr<RefCountedPageProto> >& pages, |
24 bool has_next_page, | 24 bool has_next_page, |
25 bool has_prev_page); | 25 bool has_prev_page); |
| 26 ArticleDistillationUpdate(const ArticleDistillationUpdate& other); |
26 ~ArticleDistillationUpdate(); | 27 ~ArticleDistillationUpdate(); |
27 | 28 |
28 // Returns the distilled page at |index|. | 29 // Returns the distilled page at |index|. |
29 const DistilledPageProto& GetDistilledPage(size_t index) const; | 30 const DistilledPageProto& GetDistilledPage(size_t index) const; |
30 | 31 |
31 // Returns the size of distilled pages in this update. | 32 // Returns the size of distilled pages in this update. |
32 size_t GetPagesSize() const { return pages_.size(); } | 33 size_t GetPagesSize() const { return pages_.size(); } |
33 | 34 |
34 // Returns true, if article has a next page that is currently under | 35 // Returns true, if article has a next page that is currently under |
35 // distillation and that is not part of the distilled pages included in this | 36 // distillation and that is not part of the distilled pages included in this |
36 // update. | 37 // update. |
37 bool HasNextPage() const { return has_next_page_; } | 38 bool HasNextPage() const { return has_next_page_; } |
38 | 39 |
39 // Returns true if article has a previous page that is currently under | 40 // Returns true if article has a previous page that is currently under |
40 // distillation and that is not part of the distilled pages included in this | 41 // distillation and that is not part of the distilled pages included in this |
41 // update. | 42 // update. |
42 bool HasPrevPage() const { return has_prev_page_; } | 43 bool HasPrevPage() const { return has_prev_page_; } |
43 | 44 |
44 private: | 45 private: |
45 bool has_next_page_; | 46 bool has_next_page_; |
46 bool has_prev_page_; | 47 bool has_prev_page_; |
47 // Currently available pages. | 48 // Currently available pages. |
48 std::vector<scoped_refptr<RefCountedPageProto> > pages_; | 49 std::vector<scoped_refptr<RefCountedPageProto> > pages_; |
49 }; | 50 }; |
50 | 51 |
51 } // namespace dom_distiller | 52 } // namespace dom_distiller |
52 | 53 |
53 #endif // COMPONENTS_DOM_DISTILLER_CORE_ARTICLE_DISTILLATION_UPDATE_H_ | 54 #endif // COMPONENTS_DOM_DISTILLER_CORE_ARTICLE_DISTILLATION_UPDATE_H_ |
OLD | NEW |