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

Unified Diff: components/dom_distiller/core/viewer.h

Issue 260073009: [dom_distiller] Add support for incremental viewer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: components/dom_distiller/core/viewer.h
diff --git a/components/dom_distiller/core/viewer.h b/components/dom_distiller/core/viewer.h
index 61aac1481605c6839512b4173b30b2b2245f467a..98a7e998f8ebbd2e0028ffca808b50ef4c16078e 100644
--- a/components/dom_distiller/core/viewer.h
+++ b/components/dom_distiller/core/viewer.h
@@ -10,10 +10,12 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
+#include "base/strings/string16.h"
namespace dom_distiller {
class DistilledArticleProto;
+class DistilledPageProto;
class DomDistillerServiceInterface;
class ViewerHandle;
class ViewRequestDelegate;
@@ -21,9 +23,32 @@ class ViewRequestDelegate;
namespace viewer {
// Returns a full HTML page based on the given |article_proto|. This is supposed
-// to displayed to the end user. The returned HTML should be considered unsafe,
-// so callers must ensure rendering it does not compromise Chrome.
-const std::string GetUnsafeHtml(const DistilledArticleProto* article_proto);
+// to be displayed to the end user. The returned HTML should be considered
+// unsafe, so callers must ensure rendering it does not compromise Chrome.
+const std::string GetUnsafeArticleHtml(
+ const DistilledArticleProto* article_proto);
+
+// Returns the base Viewer HTML page based on the given |page_proto|. This is
+// supposed to be displayed to the end user. The returned HTML should be
+// considered unsafe, so callers must ensure rendering it does not compromise
+// Chrome. The difference from |GetUnsafeArticleHtml| is that this can be used
+// for displaying an in-flight distillation instead of waiting for the full
+// article.
+const std::string GetUnsafePartialArticleHtml(
+ const DistilledPageProto* page_proto);
+
+// Returns a JavaScript blob for updating a partial view request with additional
+// distilled content. Meant for use when viewing a slow or long multi-page
+// article. |is_last_page| indicates whether this is the last page of the
+// article.
+const std::string GetUnsafeIncrementalDistilledPageJs(
+ const DistilledPageProto* page_proto,
+ const bool is_last_page);
+
+// Returns a JavaScript blob for controlling the "in-progress" indicator when
+// viewing a partially-distilled page. |is_last_page| indicates whether this is
+// the last page of the article (i.e. loading indicator should be removed).
+const std::string GetToggleLoadingIndicatorJs(const bool is_last_page);
// Returns a full HTML page which displays a generic error.
const std::string GetErrorPageHtml();
@@ -31,6 +56,9 @@ const std::string GetErrorPageHtml();
// Returns the default CSS to be used for a viewer.
const std::string GetCss();
+// Returns the default JS to be used for a viewer.
+const std::string GetJavaScript();
+
// Based on the given path, calls into the DomDistillerServiceInterface for
// viewing distilled content based on the |path|.
scoped_ptr<ViewerHandle> CreateViewRequest(

Powered by Google App Engine
This is Rietveld 408576698