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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 virtual ~DistillerFactoryImpl(); |
62 virtual scoped_ptr<Distiller> CreateDistiller() OVERRIDE; | 62 virtual 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 virtual ~DistillerImpl(); |
76 | 76 |
77 virtual void DistillPage( | 77 virtual void DistillPage( |
78 const GURL& url, | 78 const GURL& url, |
79 scoped_ptr<DistillerPage> distiller_page, | 79 scoped_ptr<DistillerPage> distiller_page, |
80 const DistillationFinishedCallback& finished_cb, | 80 const DistillationFinishedCallback& finished_cb, |
81 const DistillationUpdateCallback& update_cb) OVERRIDE; | 81 const DistillationUpdateCallback& update_cb) override; |
82 | 82 |
83 void SetMaxNumPagesInArticle(size_t max_num_pages); | 83 void SetMaxNumPagesInArticle(size_t max_num_pages); |
84 | 84 |
85 private: | 85 private: |
86 // In case of multiple pages, the Distiller maintains state of multiple pages | 86 // In case of multiple pages, the Distiller maintains state of multiple pages |
87 // as page numbers relative to the page number where distillation started. | 87 // 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 | 88 // 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]. | 89 // page numbers assigned to pages will be [-1,0,1]. |
90 | 90 |
91 // Class representing the state of a page under distillation. | 91 // 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_; | 183 bool destruction_allowed_; |
184 | 184 |
185 base::WeakPtrFactory<DistillerImpl> weak_factory_; | 185 base::WeakPtrFactory<DistillerImpl> weak_factory_; |
186 | 186 |
187 DISALLOW_COPY_AND_ASSIGN(DistillerImpl); | 187 DISALLOW_COPY_AND_ASSIGN(DistillerImpl); |
188 }; | 188 }; |
189 | 189 |
190 } // namespace dom_distiller | 190 } // namespace dom_distiller |
191 | 191 |
192 #endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_H_ | 192 #endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_H_ |
OLD | NEW |