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

Side by Side Diff: components/dom_distiller/core/dom_distiller_request_view_base.cc

Issue 2768093004: Remove unused feedback class in dom distiller component (Closed)
Patch Set: address comments Created 3 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "components/dom_distiller/core/dom_distiller_request_view_base.h" 5 #include "components/dom_distiller/core/dom_distiller_request_view_base.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <sstream> 8 #include <sstream>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 std::string text_direction; 49 std::string text_direction;
50 if (article_proto->pages().size() > 0) { 50 if (article_proto->pages().size() > 0) {
51 text_direction = article_proto->pages(0).text_direction(); 51 text_direction = article_proto->pages(0).text_direction();
52 } else { 52 } else {
53 text_direction = "auto"; 53 text_direction = "auto";
54 } 54 }
55 // Send first page, title, and text direction to client. 55 // Send first page, title, and text direction to client.
56 SendJavaScript(viewer::GetSetTitleJs(article_proto->title())); 56 SendJavaScript(viewer::GetSetTitleJs(article_proto->title()));
57 SendJavaScript(viewer::GetSetTextDirectionJs(text_direction)); 57 SendJavaScript(viewer::GetSetTextDirectionJs(text_direction));
58 SendJavaScript(viewer::GetUnsafeArticleContentJs(article_proto)); 58 SendJavaScript(viewer::GetUnsafeArticleContentJs(article_proto));
59 // If any content was loaded, show the feedback form.
60 if (ShouldShowFeedbackForm()) {
61 SendJavaScript(viewer::GetShowFeedbackFormJs());
62 }
63 } else { 59 } else {
64 // It's possible that we didn't get some incremental updates from the 60 // It's possible that we didn't get some incremental updates from the
65 // distiller. Ensure all remaining pages are flushed to the viewer. 61 // distiller. Ensure all remaining pages are flushed to the viewer.
66 for (; page_count_ < article_proto->pages_size(); page_count_++) { 62 for (; page_count_ < article_proto->pages_size(); page_count_++) {
67 const DistilledPageProto& page = article_proto->pages(page_count_); 63 const DistilledPageProto& page = article_proto->pages(page_count_);
68 SendJavaScript(viewer::GetUnsafeIncrementalDistilledPageJs( 64 SendJavaScript(viewer::GetUnsafeIncrementalDistilledPageJs(
69 &page, page_count_ == article_proto->pages_size())); 65 &page, page_count_ == article_proto->pages_size()));
70 } 66 }
71 } 67 }
72 // We may still be showing the "Loading" indicator. 68 // We may still be showing the "Loading" indicator.
(...skipping 11 matching lines...) Expand all
84 // Send the page content to the client. This will execute after the page is 80 // Send the page content to the client. This will execute after the page is
85 // ready. 81 // ready.
86 SendJavaScript(viewer::GetUnsafeIncrementalDistilledPageJs( 82 SendJavaScript(viewer::GetUnsafeIncrementalDistilledPageJs(
87 &page, !article_update.HasNextPage())); 83 &page, !article_update.HasNextPage()));
88 84
89 if (page_count_ == 0) { 85 if (page_count_ == 0) {
90 // This is the first page, so send the title and text direction to the 86 // This is the first page, so send the title and text direction to the
91 // client. 87 // client.
92 SendJavaScript(viewer::GetSetTitleJs(page.title())); 88 SendJavaScript(viewer::GetSetTitleJs(page.title()));
93 SendJavaScript(viewer::GetSetTextDirectionJs(page.text_direction())); 89 SendJavaScript(viewer::GetSetTextDirectionJs(page.text_direction()));
94 // If any content was loaded, show the feedback form.
95 if (ShouldShowFeedbackForm()) {
96 SendJavaScript(viewer::GetShowFeedbackFormJs());
97 }
98 } 90 }
99 } 91 }
100 } 92 }
101 93
102 void DomDistillerRequestViewBase::OnChangeTheme( 94 void DomDistillerRequestViewBase::OnChangeTheme(
103 DistilledPagePrefs::Theme new_theme) { 95 DistilledPagePrefs::Theme new_theme) {
104 SendJavaScript(viewer::GetDistilledPageThemeJs(new_theme)); 96 SendJavaScript(viewer::GetDistilledPageThemeJs(new_theme));
105 } 97 }
106 98
107 void DomDistillerRequestViewBase::OnChangeFontFamily( 99 void DomDistillerRequestViewBase::OnChangeFontFamily(
(...skipping 13 matching lines...) Expand all
121 SendCommonJavaScript(); 113 SendCommonJavaScript();
122 } 114 }
123 115
124 void DomDistillerRequestViewBase::SendCommonJavaScript() { 116 void DomDistillerRequestViewBase::SendCommonJavaScript() {
125 SendJavaScript(viewer::GetJavaScript()); 117 SendJavaScript(viewer::GetJavaScript());
126 SendJavaScript(viewer::GetDistilledPageFontScalingJs( 118 SendJavaScript(viewer::GetDistilledPageFontScalingJs(
127 distilled_page_prefs_->GetFontScaling())); 119 distilled_page_prefs_->GetFontScaling()));
128 } 120 }
129 121
130 } // namespace dom_distiller 122 } // namespace dom_distiller
OLDNEW
« no previous file with comments | « components/dom_distiller/core/css/distilledpage.css ('k') | components/dom_distiller/core/experiments.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698