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" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/strings/string16.h" | |
13 | 14 |
14 namespace dom_distiller { | 15 namespace dom_distiller { |
15 | 16 |
16 class DistilledArticleProto; | 17 class DistilledArticleProto; |
18 class DistilledPageProto; | |
17 class DomDistillerServiceInterface; | 19 class DomDistillerServiceInterface; |
18 class ViewerHandle; | 20 class ViewerHandle; |
19 class ViewRequestDelegate; | 21 class ViewRequestDelegate; |
20 | 22 |
21 namespace viewer { | 23 namespace viewer { |
22 | 24 |
23 // Returns a full HTML page based on the given |article_proto|. This is supposed | 25 // Returns a full HTML page based on the given |article_proto|. This is supposed |
24 // to displayed to the end user. The returned HTML should be considered unsafe, | 26 // to be displayed to the end user. The returned HTML should be considered |
25 // so callers must ensure rendering it does not compromise Chrome. | 27 // unsafe, so callers must ensure rendering it does not compromise Chrome. |
26 const std::string GetUnsafeHtml(const DistilledArticleProto* article_proto); | 28 const std::string GetUnsafeArticleHtml( |
29 const DistilledArticleProto* article_proto); | |
30 | |
31 // Returns the base Viewer HTML page based on the given |page_proto|. This is | |
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 | |
34 // Chrome. The difference from |GetUnsafeArticleHtml| is that this can be used | |
35 // for displaying an in-flight distillation instead of waiting for the full | |
36 // article. | |
37 const std::string GetUnsafePartialArticleHtml( | |
38 const DistilledPageProto* page_proto); | |
39 | |
40 // Returns a JavaScript blob for updating a partial view request with additional | |
41 // distilled content. Meant for use when viewing a slow or long multi-page | |
42 // article. | |
43 const std::string GetUnsafeIncrementalDistilledPageJs( | |
44 const DistilledPageProto* page_proto, | |
45 const bool is_last_page); | |
nyquist
2014/05/13 05:01:15
Nit: What is |is_last_page| for here and in the me
Yaron
2014/05/14 17:42:33
Done.
| |
46 | |
47 // Returns a JavaScript blob for controlling the "in-progress" indicator when | |
48 // viewing a partially-distilled page. | |
49 const std::string GetToggleLoadingIndicatorJs(const bool is_last_page); | |
27 | 50 |
28 // Returns a full HTML page which displays a generic error. | 51 // Returns a full HTML page which displays a generic error. |
29 const std::string GetErrorPageHtml(); | 52 const std::string GetErrorPageHtml(); |
30 | 53 |
31 // Returns the default CSS to be used for a viewer. | 54 // Returns the default CSS to be used for a viewer. |
32 const std::string GetCss(); | 55 const std::string GetCss(); |
33 | 56 |
57 // Returns the default JS to be used for a viewer. | |
58 const std::string GetJavaScript(); | |
59 | |
34 // Based on the given path, calls into the DomDistillerServiceInterface for | 60 // Based on the given path, calls into the DomDistillerServiceInterface for |
35 // viewing distilled content based on the |path|. | 61 // viewing distilled content based on the |path|. |
36 scoped_ptr<ViewerHandle> CreateViewRequest( | 62 scoped_ptr<ViewerHandle> CreateViewRequest( |
37 DomDistillerServiceInterface* dom_distiller_service, | 63 DomDistillerServiceInterface* dom_distiller_service, |
38 const std::string& path, | 64 const std::string& path, |
39 ViewRequestDelegate* view_request_delegate); | 65 ViewRequestDelegate* view_request_delegate); |
40 | 66 |
41 } // namespace viewer | 67 } // namespace viewer |
42 | 68 |
43 } // namespace dom_distiller | 69 } // namespace dom_distiller |
44 | 70 |
45 #endif // COMPONENTS_DOM_DISTILLER_CORE_VIEWER_H_ | 71 #endif // COMPONENTS_DOM_DISTILLER_CORE_VIEWER_H_ |
OLD | NEW |