Switch TestFrameNavigationObserver to DidCommitProvisionalLoadForFrame.
[chromium-blink-merge.git] / components / dom_distiller / core / viewer.h
blob7b9261f5043ac5ddd83037e078222143bab49a09
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_VIEWER_H_
6 #define COMPONENTS_DOM_DISTILLER_CORE_VIEWER_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/string16.h"
14 #include "components/dom_distiller/core/distilled_page_prefs.h"
15 #include "ui/gfx/geometry/size.h"
17 namespace dom_distiller {
19 class DistilledArticleProto;
20 class DistilledPageProto;
21 class DomDistillerServiceInterface;
22 class ViewerHandle;
23 class ViewRequestDelegate;
25 namespace viewer {
27 // Returns the JavaScript to show the feedback footer for a distilled page.
28 const std::string GetShowFeedbackFormJs();
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
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.
35 const std::string GetUnsafeArticleTemplateHtml(
36 const DistilledPageProto* page_proto,
37 const DistilledPagePrefs::Theme theme,
38 const DistilledPagePrefs::FontFamily font_family);
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
42 // rendering it does not compromise Chrome.
43 const std::string GetUnsafeArticleContentJs(
44 const DistilledArticleProto* article_proto);
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
48 // article. |is_last_page| indicates whether this is the last page of the
49 // article.
50 const std::string GetUnsafeIncrementalDistilledPageJs(
51 const DistilledPageProto* page_proto,
52 const bool is_last_page);
54 // Returns a JavaScript blob for updating a view request with error page
55 // contents.
56 const std::string GetErrorPageJs();
58 // Returns a JavaScript blob for controlling the "in-progress" indicator when
59 // 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).
61 const std::string GetToggleLoadingIndicatorJs(const bool is_last_page);
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);
68 // Returns the default CSS to be used for a viewer.
69 const std::string GetCss();
71 // Returns the default JS to be used for a viewer.
72 const std::string GetJavaScript();
74 // Based on the given path, calls into the DomDistillerServiceInterface for
75 // viewing distilled content based on the |path|.
76 scoped_ptr<ViewerHandle> CreateViewRequest(
77 DomDistillerServiceInterface* dom_distiller_service,
78 const std::string& path,
79 ViewRequestDelegate* view_request_delegate,
80 const gfx::Size& render_view_size);
82 // Returns JavaScript coresponding to setting the font family.
83 const std::string GetDistilledPageFontFamilyJs(
84 DistilledPagePrefs::FontFamily font);
86 // Returns JavaScript corresponding to setting a specific theme.
87 const std::string GetDistilledPageThemeJs(DistilledPagePrefs::Theme theme);
89 } // namespace viewer
91 } // namespace dom_distiller
93 #endif // COMPONENTS_DOM_DISTILLER_CORE_VIEWER_H_