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_service.h" | 10 #include "components/dom_distiller/core/dom_distiller_service.h" |
(...skipping 20 matching lines...) Expand all Loading... | |
31 | 31 |
32 viewer_handle_ = distillerService->ViewUrl( | 32 viewer_handle_ = distillerService->ViewUrl( |
33 this, distillerService->CreateDefaultDistillerPage(gfx::Size()), url); | 33 this, distillerService->CreateDefaultDistillerPage(gfx::Size()), url); |
34 } | 34 } |
35 | 35 |
36 DistillerViewer::~DistillerViewer() { | 36 DistillerViewer::~DistillerViewer() { |
37 } | 37 } |
38 | 38 |
39 void DistillerViewer::OnArticleReady( | 39 void DistillerViewer::OnArticleReady( |
40 const DistilledArticleProto* article_proto) { | 40 const DistilledArticleProto* article_proto) { |
41 const std::string html = viewer::GetUnsafeArticleHtml( | 41 const std::string html = viewer::GetUnsafeArticleTemplateHtml( |
42 article_proto, distilled_page_prefs_->GetTheme(), | 42 &article_proto->pages(0), distilled_page_prefs_->GetTheme(), |
43 distilled_page_prefs_->GetFontFamily()); | 43 distilled_page_prefs_->GetFontFamily()); |
44 | 44 |
45 std::string content_js = viewer::GetUnsafeArticleContentJs(article_proto); | |
46 // TODO(mdjones): This needs to eventually be placed somewhere better than | |
47 // after the closing HTML tag. | |
48 html += "<script>" + content_js + "</script>"; | |
noyau (Ping after 24h)
2015/04/01 11:42:08
This is definitely not the right way to do this.
mdjones
2015/04/01 22:25:33
Done.
| |
49 | |
50 | |
45 callback_.Run(url_, html); | 51 callback_.Run(url_, html); |
46 | 52 |
47 // No need to hold on to the ViewerHandle now that distillation is complete. | 53 // No need to hold on to the ViewerHandle now that distillation is complete. |
48 viewer_handle_.reset(); | 54 viewer_handle_.reset(); |
49 } | 55 } |
50 | 56 |
51 } // namespace dom_distiller | 57 } // namespace dom_distiller |
OLD | NEW |