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

Unified Diff: ios/chrome/browser/dom_distiller/distiller_viewer.h

Issue 972683002: Upstream dom_distiller iOS factories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@browser_state
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/dom_distiller/OWNER ('k') | ios/chrome/browser/dom_distiller/distiller_viewer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/dom_distiller/distiller_viewer.h
diff --git a/ios/chrome/browser/dom_distiller/distiller_viewer.h b/ios/chrome/browser/dom_distiller/distiller_viewer.h
new file mode 100644
index 0000000000000000000000000000000000000000..d82275511c94dea15e0f96c5c2b49f94b836a95f
--- /dev/null
+++ b/ios/chrome/browser/dom_distiller/distiller_viewer.h
@@ -0,0 +1,54 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_DOM_DISTILLER_DISTILLER_VIEWER_H_
+#define IOS_CHROME_BROWSER_DOM_DISTILLER_DISTILLER_VIEWER_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "components/dom_distiller/core/task_tracker.h"
+
+class GURL;
+
+namespace ios {
+class ChromeBrowserState;
+}
+
+namespace dom_distiller {
+
+class DistilledPagePrefs;
+
+// A very simple and naive implementation of the dom_distiller
+// ViewRequestDelegate: From an URL it builds an HTML string and notifies when
+// finished.
+class DistillerViewer : public dom_distiller::ViewRequestDelegate {
+ public:
+ typedef base::Callback<void(const GURL&, const std::string&)>
+ DistillationFinishedCallback;
+
+ DistillerViewer(ios::ChromeBrowserState* browser_state,
+ const GURL& url,
+ const DistillationFinishedCallback& callback);
+ ~DistillerViewer() override;
+
+ // ViewRequestDelegate.
+ void OnArticleUpdated(
+ dom_distiller::ArticleDistillationUpdate article_update) override {}
+ void OnArticleReady(const DistilledArticleProto* article_proto) override;
+
+ private:
+ // The url of the distilled page.
+ const GURL url_;
+ // Callback to invoke when the page is finished.
+ DistillationFinishedCallback callback_;
+ // Interface for accessing preferences for distilled pages.
+ scoped_ptr<DistilledPagePrefs> distilled_page_prefs_;
+ // Keeps the distiller going until the view is released.
+ scoped_ptr<dom_distiller::ViewerHandle> viewer_handle_;
+
+ DISALLOW_COPY_AND_ASSIGN(DistillerViewer);
+};
+
+} // namespace dom_distiller
+
+#endif // IOS_CHROME_BROWSER_DOM_DISTILLER_DISTILLER_VIEWER_H_
« no previous file with comments | « ios/chrome/browser/dom_distiller/OWNER ('k') | ios/chrome/browser/dom_distiller/distiller_viewer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698