Give names to all utility processes.
[chromium-blink-merge.git] / ios / chrome / browser / dom_distiller / distiller_viewer.h
blobd82275511c94dea15e0f96c5c2b49f94b836a95f
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
3 // found in the LICENSE file.
5 #ifndef IOS_CHROME_BROWSER_DOM_DISTILLER_DISTILLER_VIEWER_H_
6 #define IOS_CHROME_BROWSER_DOM_DISTILLER_DISTILLER_VIEWER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "components/dom_distiller/core/task_tracker.h"
11 class GURL;
13 namespace ios {
14 class ChromeBrowserState;
17 namespace dom_distiller {
19 class DistilledPagePrefs;
21 // A very simple and naive implementation of the dom_distiller
22 // ViewRequestDelegate: From an URL it builds an HTML string and notifies when
23 // finished.
24 class DistillerViewer : public dom_distiller::ViewRequestDelegate {
25 public:
26 typedef base::Callback<void(const GURL&, const std::string&)>
27 DistillationFinishedCallback;
29 DistillerViewer(ios::ChromeBrowserState* browser_state,
30 const GURL& url,
31 const DistillationFinishedCallback& callback);
32 ~DistillerViewer() override;
34 // ViewRequestDelegate.
35 void OnArticleUpdated(
36 dom_distiller::ArticleDistillationUpdate article_update) override {}
37 void OnArticleReady(const DistilledArticleProto* article_proto) override;
39 private:
40 // The url of the distilled page.
41 const GURL url_;
42 // Callback to invoke when the page is finished.
43 DistillationFinishedCallback callback_;
44 // Interface for accessing preferences for distilled pages.
45 scoped_ptr<DistilledPagePrefs> distilled_page_prefs_;
46 // Keeps the distiller going until the view is released.
47 scoped_ptr<dom_distiller::ViewerHandle> viewer_handle_;
49 DISALLOW_COPY_AND_ASSIGN(DistillerViewer);
52 } // namespace dom_distiller
54 #endif // IOS_CHROME_BROWSER_DOM_DISTILLER_DISTILLER_VIEWER_H_