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

Side by Side Diff: ios/chrome/browser/dom_distiller/distiller_viewer.cc

Issue 1015463004: Consistent content placement method for dom-distiller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IOS content fix Created 5 years, 8 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 "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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698