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 30 matching lines...) Expand all Loading... |
41 // a distilled page is added and |finished_cb| will be invoked once | 41 // a distilled page is added and |finished_cb| will be invoked once |
42 // distillation is completed. | 42 // distillation is completed. |
43 virtual void DistillPage(const GURL& url, | 43 virtual void DistillPage(const GURL& url, |
44 scoped_ptr<DistillerPage> distiller_page, | 44 scoped_ptr<DistillerPage> distiller_page, |
45 const DistillationFinishedCallback& finished_cb, | 45 const DistillationFinishedCallback& finished_cb, |
46 const DistillationUpdateCallback& update_cb) = 0; | 46 const DistillationUpdateCallback& update_cb) = 0; |
47 }; | 47 }; |
48 | 48 |
49 class DistillerFactory { | 49 class DistillerFactory { |
50 public: | 50 public: |
51 virtual scoped_ptr<Distiller> CreateDistiller() = 0; | 51 virtual scoped_ptr<Distiller> CreateDistillerForUrl(const GURL& url) = 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 ~DistillerFactoryImpl() override; | 61 ~DistillerFactoryImpl() override; |
62 scoped_ptr<Distiller> CreateDistiller() override; | 62 scoped_ptr<Distiller> CreateDistillerForUrl(const GURL& url) 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( |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 bool destruction_allowed_; | 182 bool destruction_allowed_; |
183 | 183 |
184 base::WeakPtrFactory<DistillerImpl> weak_factory_; | 184 base::WeakPtrFactory<DistillerImpl> weak_factory_; |
185 | 185 |
186 DISALLOW_COPY_AND_ASSIGN(DistillerImpl); | 186 DISALLOW_COPY_AND_ASSIGN(DistillerImpl); |
187 }; | 187 }; |
188 | 188 |
189 } // namespace dom_distiller | 189 } // namespace dom_distiller |
190 | 190 |
191 #endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_H_ | 191 #endif // COMPONENTS_DOM_DISTILLER_CORE_DISTILLER_H_ |
OLD | NEW |