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

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

Issue 2604773002: Create distiller files for Reading List. (Closed)
Patch Set: feedback Created 3 years, 11 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 #include <utility> 8 #include <utility>
9 9
10 #include "components/dom_distiller/core/distilled_page_prefs.h" 10 #include "components/dom_distiller/core/distilled_page_prefs.h"
11 #include "components/dom_distiller/core/dom_distiller_request_view_base.h" 11 #include "components/dom_distiller/core/dom_distiller_request_view_base.h"
12 #include "components/dom_distiller/core/dom_distiller_service.h" 12 #include "components/dom_distiller/core/dom_distiller_service.h"
13 #include "components/dom_distiller/core/proto/distilled_article.pb.h" 13 #include "components/dom_distiller/core/proto/distilled_article.pb.h"
14 #include "components/dom_distiller/core/task_tracker.h" 14 #include "components/dom_distiller/core/task_tracker.h"
15 #include "components/dom_distiller/core/viewer.h" 15 #include "components/dom_distiller/core/viewer.h"
16 #include "ui/gfx/geometry/size.h" 16 #include "ui/gfx/geometry/size.h"
17 17
18 namespace dom_distiller { 18 namespace dom_distiller {
19 19
20 DistillerViewer::DistillerViewer( 20 DistillerViewer::DistillerViewer(
21 dom_distiller::DomDistillerService* distillerService, 21 dom_distiller::DomDistillerService* distillerService,
22 PrefService* prefs, 22 PrefService* prefs,
23 const GURL& url, 23 const GURL& url,
24 const DistillationFinishedCallback& callback) 24 const DistillationFinishedCallback& callback,
25 const DistillerPageFactory* factory)
25 : DistillerViewerInterface(distillerService, prefs), 26 : DistillerViewerInterface(distillerService, prefs),
26 url_(url), 27 url_(url),
27 callback_(callback) { 28 callback_(callback) {
28 DCHECK(distillerService); 29 DCHECK(distillerService);
29 DCHECK(url.is_valid()); 30 DCHECK(url.is_valid());
30 31 std::unique_ptr<DistillerPage> page =
31 std::unique_ptr<ViewerHandle> viewer_handle = distillerService->ViewUrl( 32 factory ? factory->CreateDistillerPage(gfx::Size())
32 this, distillerService->CreateDefaultDistillerPage(gfx::Size()), url); 33 : distillerService->CreateDefaultDistillerPage(gfx::Size());
34 std::unique_ptr<ViewerHandle> viewer_handle =
35 distillerService->ViewUrl(this, std::move(page), url);
33 36
34 TakeViewerHandle(std::move(viewer_handle)); 37 TakeViewerHandle(std::move(viewer_handle));
35 } 38 }
36 39
37 DistillerViewer::~DistillerViewer() {} 40 DistillerViewer::~DistillerViewer() {}
38 41
39 void DistillerViewer::OnArticleReady( 42 void DistillerViewer::OnArticleReady(
40 const dom_distiller::DistilledArticleProto* article_proto) { 43 const dom_distiller::DistilledArticleProto* article_proto) {
41 DomDistillerRequestViewBase::OnArticleReady(article_proto); 44 DomDistillerRequestViewBase::OnArticleReady(article_proto);
42 bool is_empty = article_proto->pages_size() == 0 || 45 bool is_empty = article_proto->pages_size() == 0 ||
(...skipping 15 matching lines...) Expand all
58 } else { 61 } else {
59 callback_.Run(url_, std::string(), {}, std::string()); 62 callback_.Run(url_, std::string(), {}, std::string());
60 } 63 }
61 } 64 }
62 65
63 void DistillerViewer::SendJavaScript(const std::string& buffer) { 66 void DistillerViewer::SendJavaScript(const std::string& buffer) {
64 js_buffer_ += buffer; 67 js_buffer_ += buffer;
65 } 68 }
66 69
67 } // namespace dom_distiller 70 } // namespace dom_distiller
OLDNEW
« no previous file with comments | « ios/chrome/browser/dom_distiller/distiller_viewer.h ('k') | ios/chrome/browser/dom_distiller/dom_distiller_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698