Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Side by Side Diff: components/dom_distiller/core/viewer.h

Issue 1015463004: Consistent content placement method for dom-distiller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IOS content fix Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "base/strings/string16.h"
14 #include "components/dom_distiller/core/distilled_page_prefs.h" 14 #include "components/dom_distiller/core/distilled_page_prefs.h"
15 #include "ui/gfx/geometry/size.h" 15 #include "ui/gfx/geometry/size.h"
16 16
17 namespace dom_distiller { 17 namespace dom_distiller {
18 18
19 class DistilledArticleProto; 19 class DistilledArticleProto;
20 class DistilledPageProto; 20 class DistilledPageProto;
21 class DomDistillerServiceInterface; 21 class DomDistillerServiceInterface;
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 an HTML template page based on the given |page_proto| which provides
28 // to be displayed to the end user. The returned HTML should be considered 28 // basic information about the page (i.e. title, text direction, etc.). This is
29 // unsafe, so callers must ensure rendering it does not compromise Chrome.
30 const std::string GetUnsafeArticleHtml(
31 const DistilledArticleProto* article_proto,
32 const DistilledPagePrefs::Theme theme,
33 const DistilledPagePrefs::FontFamily font_family);
34
35 // Returns the base Viewer HTML page based on the given |page_proto|. This is
36 // supposed to be displayed to the end user. The returned HTML should be 29 // 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 30 // considered unsafe, so callers must ensure rendering it does not compromise
38 // Chrome. The difference from |GetUnsafeArticleHtml| is that this can be used 31 // Chrome.
39 // for displaying an in-flight distillation instead of waiting for the full 32 const std::string GetUnsafeArticleTemplateHtml(
40 // article.
41 const std::string GetUnsafePartialArticleHtml(
42 const DistilledPageProto* page_proto, 33 const DistilledPageProto* page_proto,
43 const DistilledPagePrefs::Theme theme, 34 const DistilledPagePrefs::Theme theme,
44 const DistilledPagePrefs::FontFamily font_family); 35 const DistilledPagePrefs::FontFamily font_family);
45 36
37 // Returns the JavaScript to place a full article's HTML on the page. The
38 // returned HTML should be considered unsafe, so callers must ensure
39 // rendering it does not compromise Chrome.
40 const std::string GetUnsafeArticleContentJs(
41 const DistilledArticleProto* article_proto);
42
46 // Returns a JavaScript blob for updating a partial view request with additional 43 // 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 44 // 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 45 // article. |is_last_page| indicates whether this is the last page of the
49 // article. 46 // article.
50 const std::string GetUnsafeIncrementalDistilledPageJs( 47 const std::string GetUnsafeIncrementalDistilledPageJs(
51 const DistilledPageProto* page_proto, 48 const DistilledPageProto* page_proto,
52 const bool is_last_page); 49 const bool is_last_page);
53 50
51 // Returns a JavaScript blob for updating a view request with error page
52 // contents.
53 const std::string GetErrorPageJs();
54
54 // Returns a JavaScript blob for controlling the "in-progress" indicator when 55 // Returns a JavaScript blob for controlling the "in-progress" indicator when
55 // viewing a partially-distilled page. |is_last_page| indicates whether this is 56 // 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). 57 // the last page of the article (i.e. loading indicator should be removed).
57 const std::string GetToggleLoadingIndicatorJs(const bool is_last_page); 58 const std::string GetToggleLoadingIndicatorJs(const bool is_last_page);
58 59
59 // Returns a full HTML page which displays a generic error. 60 // Returns a full HTML page which displays a generic error.
60 const std::string GetErrorPageHtml( 61 const std::string GetErrorPageHtml(
61 const DistilledPagePrefs::Theme theme, 62 const DistilledPagePrefs::Theme theme,
62 const DistilledPagePrefs::FontFamily font_family); 63 const DistilledPagePrefs::FontFamily font_family);
63 64
(...skipping 16 matching lines...) Expand all
80 DistilledPagePrefs::FontFamily font); 81 DistilledPagePrefs::FontFamily font);
81 82
82 // Returns JavaScript corresponding to setting a specific theme. 83 // Returns JavaScript corresponding to setting a specific theme.
83 const std::string GetDistilledPageThemeJs(DistilledPagePrefs::Theme theme); 84 const std::string GetDistilledPageThemeJs(DistilledPagePrefs::Theme theme);
84 85
85 } // namespace viewer 86 } // namespace viewer
86 87
87 } // namespace dom_distiller 88 } // namespace dom_distiller
88 89
89 #endif // COMPONENTS_DOM_DISTILLER_CORE_VIEWER_H_ 90 #endif // COMPONENTS_DOM_DISTILLER_CORE_VIEWER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698