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

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

Issue 2650593003: Store distilled URL during distillation in Reading List on iOS (Closed)
Patch Set: 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 std::unique_ptr<dom_distiller::DistillerPage> page)
26 : DistillerViewerInterface(distillerService, prefs), 26 : DistillerViewerInterface(distillerService, prefs),
27 url_(url), 27 url_(url),
28 callback_(callback) { 28 callback_(callback) {
29 DCHECK(distillerService); 29 DCHECK(distillerService);
30 DCHECK(url.is_valid()); 30 DCHECK(url.is_valid());
31 std::unique_ptr<DistillerPage> page = 31 if (!page) {
32 factory ? factory->CreateDistillerPage(gfx::Size()) 32 page = distillerService->CreateDefaultDistillerPage(gfx::Size());
33 : distillerService->CreateDefaultDistillerPage(gfx::Size()); 33 }
34
34 std::unique_ptr<ViewerHandle> viewer_handle = 35 std::unique_ptr<ViewerHandle> viewer_handle =
35 distillerService->ViewUrl(this, std::move(page), url); 36 distillerService->ViewUrl(this, std::move(page), url);
36 37
37 TakeViewerHandle(std::move(viewer_handle)); 38 TakeViewerHandle(std::move(viewer_handle));
38 } 39 }
39 40
40 DistillerViewer::~DistillerViewer() {} 41 DistillerViewer::~DistillerViewer() {}
41 42
42 void DistillerViewer::OnArticleReady( 43 void DistillerViewer::OnArticleReady(
43 const dom_distiller::DistilledArticleProto* article_proto) { 44 const dom_distiller::DistilledArticleProto* article_proto) {
(...skipping 17 matching lines...) Expand all
61 } else { 62 } else {
62 callback_.Run(url_, std::string(), {}, std::string()); 63 callback_.Run(url_, std::string(), {}, std::string());
63 } 64 }
64 } 65 }
65 66
66 void DistillerViewer::SendJavaScript(const std::string& buffer) { 67 void DistillerViewer::SendJavaScript(const std::string& buffer) {
67 js_buffer_ += buffer; 68 js_buffer_ += buffer;
68 } 69 }
69 70
70 } // namespace dom_distiller 71 } // namespace dom_distiller
OLDNEW
« no previous file with comments | « ios/chrome/browser/dom_distiller/distiller_viewer.h ('k') | ios/chrome/browser/reading_list/reading_list_distiller_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698