Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 IOS_CHROME_BROWSER_DOM_DISTILLER_DISTILLER_VIEWER_H_ | 5 #ifndef IOS_CHROME_BROWSER_DOM_DISTILLER_DISTILLER_VIEWER_H_ |
| 6 #define IOS_CHROME_BROWSER_DOM_DISTILLER_DISTILLER_VIEWER_H_ | 6 #define IOS_CHROME_BROWSER_DOM_DISTILLER_DISTILLER_VIEWER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "components/dom_distiller/core/dom_distiller_request_view_base.h" | 12 #include "components/dom_distiller/core/dom_distiller_request_view_base.h" |
| 13 #include "components/dom_distiller/core/task_tracker.h" | 13 #include "components/dom_distiller/core/task_tracker.h" |
| 14 | 14 |
| 15 class GURL; | 15 class GURL; |
| 16 | 16 |
| 17 namespace dom_distiller { | 17 namespace dom_distiller { |
| 18 | 18 |
| 19 class DistilledPagePrefs; | 19 class DistilledPagePrefs; |
| 20 | 20 |
| 21 // An interface for a dom_distiller ViewRequestDelegate that distills a URL and | 21 // An interface for a dom_distiller ViewRequestDelegate that distills a URL and |
| 22 // calls the given callback with the distilled HTML string and the images it | 22 // calls the given callback with the distilled HTML string and the images it |
| 23 // contains. | 23 // contains. |
| 24 class DistillerViewerInterface : public DomDistillerRequestViewBase { | 24 class DistillerViewerInterface : public DomDistillerRequestViewBase { |
| 25 public: | 25 public: |
| 26 typedef struct { | 26 struct ImageInfo { |
| 27 // The url of the image. | 27 // The url of the image. |
| 28 GURL url; | 28 GURL url; |
| 29 // The image data as a string. | 29 // The image data as a string. |
| 30 std::string data; | 30 std::string data; |
| 31 } ImageInfo; | 31 }; |
| 32 typedef base::Callback<void(const GURL&, | 32 typedef base::Callback<void(const GURL& url, |
| 33 const std::string&, | 33 const std::string& html, |
| 34 const std::vector<ImageInfo>& images)> | 34 const std::vector<ImageInfo>& images, |
| 35 const std::string& title)> | |
|
gambard
2016/09/15 13:14:11
This breaks reader_mode_controller.mm
| |
| 35 DistillationFinishedCallback; | 36 DistillationFinishedCallback; |
| 36 | 37 |
| 37 DistillerViewerInterface(dom_distiller::DomDistillerService* distillerService, | 38 DistillerViewerInterface(dom_distiller::DomDistillerService* distillerService, |
| 38 PrefService* prefs) | 39 PrefService* prefs) |
| 39 : DomDistillerRequestViewBase(new DistilledPagePrefs(prefs)) {} | 40 : DomDistillerRequestViewBase(new DistilledPagePrefs(prefs)) {} |
| 40 ~DistillerViewerInterface() override {} | 41 ~DistillerViewerInterface() override {} |
| 41 | 42 |
| 42 void OnArticleReady( | 43 void OnArticleReady( |
| 43 const dom_distiller::DistilledArticleProto* article_proto) override = 0; | 44 const dom_distiller::DistilledArticleProto* article_proto) override = 0; |
| 44 | 45 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 68 std::string js_buffer_; | 69 std::string js_buffer_; |
| 69 // Callback to run once distillation is complete. | 70 // Callback to run once distillation is complete. |
| 70 const DistillationFinishedCallback callback_; | 71 const DistillationFinishedCallback callback_; |
| 71 | 72 |
| 72 DISALLOW_COPY_AND_ASSIGN(DistillerViewer); | 73 DISALLOW_COPY_AND_ASSIGN(DistillerViewer); |
| 73 }; | 74 }; |
| 74 | 75 |
| 75 } // namespace dom_distiller | 76 } // namespace dom_distiller |
| 76 | 77 |
| 77 #endif // IOS_CHROME_BROWSER_DOM_DISTILLER_DISTILLER_VIEWER_H_ | 78 #endif // IOS_CHROME_BROWSER_DOM_DISTILLER_DISTILLER_VIEWER_H_ |
| OLD | NEW |