| 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 14 matching lines...) Expand all Loading... |
| 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 const DistilledPagePrefs::FontFamily font_family); |
| 34 | 34 |
| 35 // Returns the base Viewer HTML page based on the given |page_proto|. This is | 35 // Returns an HTML template page based on the given |page_proto| which provides |
| 36 // basic information about the page (i.e. title, text direction, etc.). This is |
| 36 // supposed to be displayed to the end user. The returned HTML should be | 37 // supposed to be displayed to the end user. The returned HTML should be |
| 37 // considered unsafe, so callers must ensure rendering it does not compromise | 38 // considered unsafe, so callers must ensure rendering it does not compromise |
| 38 // Chrome. The difference from |GetUnsafeArticleHtml| is that this can be used | 39 // Chrome. |
| 39 // for displaying an in-flight distillation instead of waiting for the full | 40 const std::string GetUnsafeArticleTemplateHtml( |
| 40 // article. | |
| 41 const std::string GetUnsafePartialArticleHtml( | |
| 42 const DistilledPageProto* page_proto, | 41 const DistilledPageProto* page_proto, |
| 43 const DistilledPagePrefs::Theme theme, | 42 const DistilledPagePrefs::Theme theme, |
| 44 const DistilledPagePrefs::FontFamily font_family); | 43 const DistilledPagePrefs::FontFamily font_family); |
| 45 | 44 |
| 45 // Returns the JavaScript to place a full article's HTML on the page. The |
| 46 // returned HTML should be considered unsafe, so callers must ensure |
| 47 // rendering it does not compromise Chrome. |
| 48 const std::string GetUnsafeArticleContentJs( |
| 49 const DistilledArticleProto* article_proto); |
| 50 |
| 46 // Returns a JavaScript blob for updating a partial view request with additional | 51 // Returns a JavaScript blob for updating a partial view request with additional |
| 47 // distilled content. Meant for use when viewing a slow or long multi-page | 52 // distilled content. Meant for use when viewing a slow or long multi-page |
| 48 // article. |is_last_page| indicates whether this is the last page of the | 53 // article. |is_last_page| indicates whether this is the last page of the |
| 49 // article. | 54 // article. |
| 50 const std::string GetUnsafeIncrementalDistilledPageJs( | 55 const std::string GetUnsafeIncrementalDistilledPageJs( |
| 51 const DistilledPageProto* page_proto, | 56 const DistilledPageProto* page_proto, |
| 52 const bool is_last_page); | 57 const bool is_last_page); |
| 53 | 58 |
| 59 // Returns a JavaScript blob for updating a view request with error page |
| 60 // contents. |
| 61 const std::string GetErrorPageJs(); |
| 62 |
| 54 // Returns a JavaScript blob for controlling the "in-progress" indicator when | 63 // Returns a JavaScript blob for controlling the "in-progress" indicator when |
| 55 // viewing a partially-distilled page. |is_last_page| indicates whether this is | 64 // viewing a partially-distilled page. |is_last_page| indicates whether this is |
| 56 // the last page of the article (i.e. loading indicator should be removed). | 65 // the last page of the article (i.e. loading indicator should be removed). |
| 57 const std::string GetToggleLoadingIndicatorJs(const bool is_last_page); | 66 const std::string GetToggleLoadingIndicatorJs(const bool is_last_page); |
| 58 | 67 |
| 59 // Returns a full HTML page which displays a generic error. | 68 // Returns a full HTML page which displays a generic error. |
| 60 const std::string GetErrorPageHtml( | 69 const std::string GetErrorPageHtml( |
| 61 const DistilledPagePrefs::Theme theme, | 70 const DistilledPagePrefs::Theme theme, |
| 62 const DistilledPagePrefs::FontFamily font_family); | 71 const DistilledPagePrefs::FontFamily font_family); |
| 63 | 72 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 80 DistilledPagePrefs::FontFamily font); | 89 DistilledPagePrefs::FontFamily font); |
| 81 | 90 |
| 82 // Returns JavaScript corresponding to setting a specific theme. | 91 // Returns JavaScript corresponding to setting a specific theme. |
| 83 const std::string GetDistilledPageThemeJs(DistilledPagePrefs::Theme theme); | 92 const std::string GetDistilledPageThemeJs(DistilledPagePrefs::Theme theme); |
| 84 | 93 |
| 85 } // namespace viewer | 94 } // namespace viewer |
| 86 | 95 |
| 87 } // namespace dom_distiller | 96 } // namespace dom_distiller |
| 88 | 97 |
| 89 #endif // COMPONENTS_DOM_DISTILLER_CORE_VIEWER_H_ | 98 #endif // COMPONENTS_DOM_DISTILLER_CORE_VIEWER_H_ |
| OLD | NEW |