| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_VIEWER_H_ | 5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_VIEWER_H_ |
| 6 #define COMPONENTS_DOM_DISTILLER_CORE_VIEWER_H_ | 6 #define COMPONENTS_DOM_DISTILLER_CORE_VIEWER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class ViewerHandle; | 22 class ViewerHandle; |
| 23 class ViewRequestDelegate; | 23 class ViewRequestDelegate; |
| 24 | 24 |
| 25 namespace viewer { | 25 namespace viewer { |
| 26 | 26 |
| 27 // Returns a full HTML page based on the given |article_proto|. This is supposed | 27 // Returns a full HTML page based on the given |article_proto|. This is supposed |
| 28 // to be displayed to the end user. The returned HTML should be considered | 28 // to be displayed to the end user. The returned HTML should be considered |
| 29 // unsafe, so callers must ensure rendering it does not compromise Chrome. | 29 // unsafe, so callers must ensure rendering it does not compromise Chrome. |
| 30 const std::string GetUnsafeArticleHtml( | 30 const std::string GetUnsafeArticleHtml( |
| 31 const DistilledArticleProto* article_proto, | 31 const DistilledArticleProto* article_proto, |
| 32 const DistilledPagePrefs::Theme theme); | 32 const DistilledPagePrefs::Theme theme, |
| 33 const DistilledPagePrefs::FontFamily font_family); |
| 33 | 34 |
| 34 // Returns the base Viewer HTML page based on the given |page_proto|. This is | 35 // Returns the base Viewer HTML page based on the given |page_proto|. This is |
| 35 // supposed to be displayed to the end user. The returned HTML should be | 36 // supposed to be displayed to the end user. The returned HTML should be |
| 36 // considered unsafe, so callers must ensure rendering it does not compromise | 37 // considered unsafe, so callers must ensure rendering it does not compromise |
| 37 // Chrome. The difference from |GetUnsafeArticleHtml| is that this can be used | 38 // Chrome. The difference from |GetUnsafeArticleHtml| is that this can be used |
| 38 // for displaying an in-flight distillation instead of waiting for the full | 39 // for displaying an in-flight distillation instead of waiting for the full |
| 39 // article. | 40 // article. |
| 40 const std::string GetUnsafePartialArticleHtml( | 41 const std::string GetUnsafePartialArticleHtml( |
| 41 const DistilledPageProto* page_proto, | 42 const DistilledPageProto* page_proto, |
| 42 const DistilledPagePrefs::Theme theme); | 43 const DistilledPagePrefs::Theme theme, |
| 44 const DistilledPagePrefs::FontFamily font_family); |
| 43 | 45 |
| 44 // Returns a JavaScript blob for updating a partial view request with additional | 46 // Returns a JavaScript blob for updating a partial view request with additional |
| 45 // distilled content. Meant for use when viewing a slow or long multi-page | 47 // distilled content. Meant for use when viewing a slow or long multi-page |
| 46 // article. |is_last_page| indicates whether this is the last page of the | 48 // article. |is_last_page| indicates whether this is the last page of the |
| 47 // article. | 49 // article. |
| 48 const std::string GetUnsafeIncrementalDistilledPageJs( | 50 const std::string GetUnsafeIncrementalDistilledPageJs( |
| 49 const DistilledPageProto* page_proto, | 51 const DistilledPageProto* page_proto, |
| 50 const bool is_last_page); | 52 const bool is_last_page); |
| 51 | 53 |
| 52 // Returns a JavaScript blob for controlling the "in-progress" indicator when | 54 // Returns a JavaScript blob for controlling the "in-progress" indicator when |
| 53 // viewing a partially-distilled page. |is_last_page| indicates whether this is | 55 // viewing a partially-distilled page. |is_last_page| indicates whether this is |
| 54 // the last page of the article (i.e. loading indicator should be removed). | 56 // the last page of the article (i.e. loading indicator should be removed). |
| 55 const std::string GetToggleLoadingIndicatorJs(const bool is_last_page); | 57 const std::string GetToggleLoadingIndicatorJs(const bool is_last_page); |
| 56 | 58 |
| 57 // Returns a full HTML page which displays a generic error. | 59 // Returns a full HTML page which displays a generic error. |
| 58 const std::string GetErrorPageHtml(const DistilledPagePrefs::Theme theme); | 60 const std::string GetErrorPageHtml( |
| 61 const DistilledPagePrefs::Theme theme, |
| 62 const DistilledPagePrefs::FontFamily font_family); |
| 59 | 63 |
| 60 // Returns the default CSS to be used for a viewer. | 64 // Returns the default CSS to be used for a viewer. |
| 61 const std::string GetCss(); | 65 const std::string GetCss(); |
| 62 | 66 |
| 63 // Returns the default JS to be used for a viewer. | 67 // Returns the default JS to be used for a viewer. |
| 64 const std::string GetJavaScript(); | 68 const std::string GetJavaScript(); |
| 65 | 69 |
| 66 // Based on the given path, calls into the DomDistillerServiceInterface for | 70 // Based on the given path, calls into the DomDistillerServiceInterface for |
| 67 // viewing distilled content based on the |path|. | 71 // viewing distilled content based on the |path|. |
| 68 scoped_ptr<ViewerHandle> CreateViewRequest( | 72 scoped_ptr<ViewerHandle> CreateViewRequest( |
| 69 DomDistillerServiceInterface* dom_distiller_service, | 73 DomDistillerServiceInterface* dom_distiller_service, |
| 70 const std::string& path, | 74 const std::string& path, |
| 71 ViewRequestDelegate* view_request_delegate, | 75 ViewRequestDelegate* view_request_delegate, |
| 72 const gfx::Size& render_view_size); | 76 const gfx::Size& render_view_size); |
| 73 | 77 |
| 78 // Returns JavaScript coresponding to setting the font family. |
| 79 const std::string GetDistilledPageFontFamilyJs( |
| 80 DistilledPagePrefs::FontFamily font); |
| 81 |
| 74 // Returns JavaScript corresponding to setting a specific theme. | 82 // Returns JavaScript corresponding to setting a specific theme. |
| 75 const std::string GetDistilledPageThemeJs(DistilledPagePrefs::Theme theme); | 83 const std::string GetDistilledPageThemeJs(DistilledPagePrefs::Theme theme); |
| 76 | 84 |
| 77 } // namespace viewer | 85 } // namespace viewer |
| 78 | 86 |
| 79 } // namespace dom_distiller | 87 } // namespace dom_distiller |
| 80 | 88 |
| 81 #endif // COMPONENTS_DOM_DISTILLER_CORE_VIEWER_H_ | 89 #endif // COMPONENTS_DOM_DISTILLER_CORE_VIEWER_H_ |
| OLD | NEW |