OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_DOM_DISTILLER_DISTILLER_VIEWER_H_ |
| 6 #define IOS_CHROME_BROWSER_DOM_DISTILLER_DISTILLER_VIEWER_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "components/dom_distiller/core/task_tracker.h" |
| 10 |
| 11 class GURL; |
| 12 |
| 13 namespace ios { |
| 14 class ChromeBrowserState; |
| 15 } |
| 16 |
| 17 namespace dom_distiller { |
| 18 |
| 19 class DistilledPagePrefs; |
| 20 |
| 21 // A very simple and naive implementation of the dom_distiller |
| 22 // ViewRequestDelegate: From an URL it builds an HTML string and notifies when |
| 23 // finished. |
| 24 class DistillerViewer : public dom_distiller::ViewRequestDelegate { |
| 25 public: |
| 26 typedef base::Callback<void(const GURL&, const std::string&)> |
| 27 DistillationFinishedCallback; |
| 28 |
| 29 DistillerViewer(ios::ChromeBrowserState* browser_state, |
| 30 const GURL& url, |
| 31 const DistillationFinishedCallback& callback); |
| 32 ~DistillerViewer() override; |
| 33 |
| 34 // ViewRequestDelegate. |
| 35 void OnArticleUpdated( |
| 36 dom_distiller::ArticleDistillationUpdate article_update) override {} |
| 37 void OnArticleReady(const DistilledArticleProto* article_proto) override; |
| 38 |
| 39 private: |
| 40 // The url of the distilled page. |
| 41 const GURL url_; |
| 42 // Callback to invoke when the page is finished. |
| 43 DistillationFinishedCallback callback_; |
| 44 // Interface for accessing preferences for distilled pages. |
| 45 scoped_ptr<DistilledPagePrefs> distilled_page_prefs_; |
| 46 // Keeps the distiller going until the view is released. |
| 47 scoped_ptr<dom_distiller::ViewerHandle> viewer_handle_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(DistillerViewer); |
| 50 }; |
| 51 |
| 52 } // namespace dom_distiller |
| 53 |
| 54 #endif // IOS_CHROME_BROWSER_DOM_DISTILLER_DISTILLER_VIEWER_H_ |
OLD | NEW |