OLD | NEW |
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 "ios/chrome/browser/dom_distiller/distiller_viewer.h" | 5 #include "ios/chrome/browser/dom_distiller/distiller_viewer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "components/dom_distiller/core/distilled_page_prefs.h" | 9 #include "components/dom_distiller/core/distilled_page_prefs.h" |
10 #include "components/dom_distiller/core/dom_distiller_request_view_base.h" | 10 #include "components/dom_distiller/core/dom_distiller_request_view_base.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 void DistillerViewer::OnArticleReady( | 43 void DistillerViewer::OnArticleReady( |
44 const dom_distiller::DistilledArticleProto* article_proto) { | 44 const dom_distiller::DistilledArticleProto* article_proto) { |
45 DomDistillerRequestViewBase::OnArticleReady(article_proto); | 45 DomDistillerRequestViewBase::OnArticleReady(article_proto); |
46 | 46 |
47 const std::string html = viewer::GetUnsafeArticleTemplateHtml( | 47 const std::string html = viewer::GetUnsafeArticleTemplateHtml( |
48 url_.spec(), distilled_page_prefs_->GetTheme(), | 48 url_.spec(), distilled_page_prefs_->GetTheme(), |
49 distilled_page_prefs_->GetFontFamily()); | 49 distilled_page_prefs_->GetFontFamily()); |
50 | 50 |
51 std::string html_and_script(html); | 51 std::string html_and_script(html); |
52 std::string hide_feedback = | 52 html_and_script += |
53 "document.getElementById('feedbackContainer').style.display = 'none';"; | 53 "<script> distiller_on_ios = true; " + js_buffer_ + "</script>"; |
54 html_and_script += "<script>" + js_buffer_ + hide_feedback + "</script>"; | |
55 callback_.Run(url_, html_and_script); | 54 callback_.Run(url_, html_and_script); |
56 } | 55 } |
57 | 56 |
58 void DistillerViewer::SendJavaScript(const std::string& buffer) { | 57 void DistillerViewer::SendJavaScript(const std::string& buffer) { |
59 js_buffer_ += buffer; | 58 js_buffer_ += buffer; |
60 } | 59 } |
61 | 60 |
62 } // namespace dom_distiller | 61 } // namespace dom_distiller |
OLD | NEW |