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 15 matching lines...) Expand all Loading... |
26 | 26 |
27 // Returns the JavaScript to show the feedback footer for a distilled page. | 27 // Returns the JavaScript to show the feedback footer for a distilled page. |
28 const std::string GetShowFeedbackFormJs(); | 28 const std::string GetShowFeedbackFormJs(); |
29 | 29 |
30 // Returns an HTML template page based on the given |page_proto| which provides | 30 // Returns an HTML template page based on the given |page_proto| which provides |
31 // basic information about the page (i.e. title, text direction, etc.). This is | 31 // basic information about the page (i.e. title, text direction, etc.). This is |
32 // supposed to be displayed to the end user. The returned HTML should be | 32 // supposed to be displayed to the end user. The returned HTML should be |
33 // considered unsafe, so callers must ensure rendering it does not compromise | 33 // considered unsafe, so callers must ensure rendering it does not compromise |
34 // Chrome. | 34 // Chrome. |
35 const std::string GetUnsafeArticleTemplateHtml( | 35 const std::string GetUnsafeArticleTemplateHtml( |
36 const DistilledPageProto* page_proto, | 36 const std::string original_url, |
37 const DistilledPagePrefs::Theme theme, | 37 const DistilledPagePrefs::Theme theme, |
38 const DistilledPagePrefs::FontFamily font_family); | 38 const DistilledPagePrefs::FontFamily font_family); |
39 | 39 |
40 // Returns the JavaScript to place a full article's HTML on the page. The | 40 // Returns the JavaScript to place a full article's HTML on the page. The |
41 // returned HTML should be considered unsafe, so callers must ensure | 41 // returned HTML should be considered unsafe, so callers must ensure |
42 // rendering it does not compromise Chrome. | 42 // rendering it does not compromise Chrome. |
43 const std::string GetUnsafeArticleContentJs( | 43 const std::string GetUnsafeArticleContentJs( |
44 const DistilledArticleProto* article_proto); | 44 const DistilledArticleProto* article_proto); |
45 | 45 |
46 // 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 |
47 // 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 |
48 // 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 |
49 // article. | 49 // article. |
50 const std::string GetUnsafeIncrementalDistilledPageJs( | 50 const std::string GetUnsafeIncrementalDistilledPageJs( |
51 const DistilledPageProto* page_proto, | 51 const DistilledPageProto* page_proto, |
52 const bool is_last_page); | 52 const bool is_last_page); |
53 | 53 |
| 54 // Returns the JavaScript to set the title of the distilled article page. |
| 55 const std::string GetSetTitleJs(std::string title); |
| 56 |
| 57 // Return the JavaScript to set the text direction of the distiller page. |
| 58 const std::string GetSetTextDirectionJs(const std::string& direction); |
| 59 |
54 // Returns a JavaScript blob for updating a view request with error page | 60 // Returns a JavaScript blob for updating a view request with error page |
55 // contents. | 61 // contents. |
56 const std::string GetErrorPageJs(); | 62 const std::string GetErrorPageJs(); |
57 | 63 |
58 // Returns a JavaScript blob for controlling the "in-progress" indicator when | 64 // Returns a JavaScript blob for controlling the "in-progress" indicator when |
59 // viewing a partially-distilled page. |is_last_page| indicates whether this is | 65 // viewing a partially-distilled page. |is_last_page| indicates whether this is |
60 // the last page of the article (i.e. loading indicator should be removed). | 66 // the last page of the article (i.e. loading indicator should be removed). |
61 const std::string GetToggleLoadingIndicatorJs(const bool is_last_page); | 67 const std::string GetToggleLoadingIndicatorJs(const bool is_last_page); |
62 | 68 |
63 // Returns a full HTML page which displays a generic error. | |
64 const std::string GetErrorPageHtml( | |
65 const DistilledPagePrefs::Theme theme, | |
66 const DistilledPagePrefs::FontFamily font_family); | |
67 | |
68 // Returns the default CSS to be used for a viewer. | 69 // Returns the default CSS to be used for a viewer. |
69 const std::string GetCss(); | 70 const std::string GetCss(); |
70 | 71 |
71 // Returns the default JS to be used for a viewer. | 72 // Returns the default JS to be used for a viewer. |
72 const std::string GetJavaScript(); | 73 const std::string GetJavaScript(); |
73 | 74 |
74 // Based on the given path, calls into the DomDistillerServiceInterface for | 75 // Based on the given path, calls into the DomDistillerServiceInterface for |
75 // viewing distilled content based on the |path|. | 76 // viewing distilled content based on the |path|. |
76 scoped_ptr<ViewerHandle> CreateViewRequest( | 77 scoped_ptr<ViewerHandle> CreateViewRequest( |
77 DomDistillerServiceInterface* dom_distiller_service, | 78 DomDistillerServiceInterface* dom_distiller_service, |
78 const std::string& path, | 79 const std::string& path, |
79 ViewRequestDelegate* view_request_delegate, | 80 ViewRequestDelegate* view_request_delegate, |
80 const gfx::Size& render_view_size); | 81 const gfx::Size& render_view_size); |
81 | 82 |
82 // Returns JavaScript coresponding to setting the font family. | 83 // Returns JavaScript coresponding to setting the font family. |
83 const std::string GetDistilledPageFontFamilyJs( | 84 const std::string GetDistilledPageFontFamilyJs( |
84 DistilledPagePrefs::FontFamily font); | 85 DistilledPagePrefs::FontFamily font); |
85 | 86 |
86 // Returns JavaScript corresponding to setting a specific theme. | 87 // Returns JavaScript corresponding to setting a specific theme. |
87 const std::string GetDistilledPageThemeJs(DistilledPagePrefs::Theme theme); | 88 const std::string GetDistilledPageThemeJs(DistilledPagePrefs::Theme theme); |
88 | 89 |
89 } // namespace viewer | 90 } // namespace viewer |
90 | 91 |
91 } // namespace dom_distiller | 92 } // namespace dom_distiller |
92 | 93 |
93 #endif // COMPONENTS_DOM_DISTILLER_CORE_VIEWER_H_ | 94 #endif // COMPONENTS_DOM_DISTILLER_CORE_VIEWER_H_ |
OLD | NEW |