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 #ifndef COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_H_ | 5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_H_ |
6 #define COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_H_ | 6 #define COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 virtual scoped_ptr<Distiller> CreateDistiller() = 0; | 51 virtual scoped_ptr<Distiller> CreateDistiller() = 0; |
52 virtual ~DistillerFactory() {} | 52 virtual ~DistillerFactory() {} |
53 }; | 53 }; |
54 | 54 |
55 // Factory for creating a Distiller. | 55 // Factory for creating a Distiller. |
56 class DistillerFactoryImpl : public DistillerFactory { | 56 class DistillerFactoryImpl : public DistillerFactory { |
57 public: | 57 public: |
58 DistillerFactoryImpl( | 58 DistillerFactoryImpl( |
59 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory, | 59 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory, |
60 const dom_distiller::proto::DomDistillerOptions& dom_distiller_options); | 60 const dom_distiller::proto::DomDistillerOptions& dom_distiller_options); |
61 virtual ~DistillerFactoryImpl(); | 61 ~DistillerFactoryImpl() override; |
62 virtual scoped_ptr<Distiller> CreateDistiller() override; | 62 scoped_ptr<Distiller> CreateDistiller() override; |
63 | 63 |
64 private: | 64 private: |
65 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory_; | 65 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory_; |
66 dom_distiller::proto::DomDistillerOptions dom_distiller_options_; | 66 dom_distiller::proto::DomDistillerOptions dom_distiller_options_; |
67 }; | 67 }; |
68 | 68 |
69 // Distills a article from a page and associated pages. | 69 // Distills a article from a page and associated pages. |
70 class DistillerImpl : public Distiller { | 70 class DistillerImpl : public Distiller { |
71 public: | 71 public: |
72 DistillerImpl( | 72 DistillerImpl( |
73 const DistillerURLFetcherFactory& distiller_url_fetcher_factory, | 73 const DistillerURLFetcherFactory& distiller_url_fetcher_factory, |
74 const dom_distiller::proto::DomDistillerOptions& dom_distiller_options); | 74 const dom_distiller::proto::DomDistillerOptions& dom_distiller_options); |
75 virtual ~DistillerImpl(); | 75 ~DistillerImpl() override; |
76 | 76 |
77 virtual void DistillPage( | 77 void DistillPage(const GURL& url, |
78 const GURL& url, | 78 scoped_ptr<DistillerPage> distiller_page, |
79 scoped_ptr<DistillerPage> distiller_page, | 79 const DistillationFinishedCallback& finished_cb, |
80 const DistillationFinishedCallback& finished_cb, | 80 const DistillationUpdateCallback& update_cb) override; |
81 const DistillationUpdateCallback& update_cb) override; | |
82 | 81 |
83 void SetMaxNumPagesInArticle(size_t max_num_pages); | 82 void SetMaxNumPagesInArticle(size_t max_num_pages); |
84 | 83 |
85 private: | 84 private: |
86 // In case of multiple pages, the Distiller maintains state of multiple pages | 85 // In case of multiple pages, the Distiller maintains state of multiple pages |
87 // as page numbers relative to the page number where distillation started. | 86 // as page numbers relative to the page number where distillation started. |
88 // E.g. if distillation starts at page 2 for a 3 page article. The relative | 87 // E.g. if distillation starts at page 2 for a 3 page article. The relative |
89 // page numbers assigned to pages will be [-1,0,1]. | 88 // page numbers assigned to pages will be [-1,0,1]. |
90 | 89 |
91 // Class representing the state of a page under distillation. | 90 // Class representing the state of a page under distillation. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 bool destruction_allowed_; | 182 bool destruction_allowed_; |
184 | 183 |
185 base::WeakPtrFactory<DistillerImpl> weak_factory_; | 184 base::WeakPtrFactory<DistillerImpl> weak_factory_; |
186 | 185 |
187 DISALLOW_COPY_AND_ASSIGN(DistillerImpl); | 186 DISALLOW_COPY_AND_ASSIGN(DistillerImpl); |
188 }; | 187 }; |
189 | 188 |
190 } // namespace dom_distiller | 189 } // namespace dom_distiller |
191 | 190 |
192 #endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_H_ | 191 #endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_H_ |
OLD | NEW |