Index: components/dom_distiller/core/page_distiller.h |
diff --git a/components/dom_distiller/core/page_distiller.h b/components/dom_distiller/core/page_distiller.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f8bafd75a246fe30ae2f3d9e271a279c824822a5 |
--- /dev/null |
+++ b/components/dom_distiller/core/page_distiller.h |
@@ -0,0 +1,69 @@ |
+// Copyright 2014 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 COMPONENTS_DOM_DISTILLER_CORE_PAGE_DISTILLER_H_ |
+#define COMPONENTS_DOM_DISTILLER_CORE_PAGE_DISTILLER_H_ |
+ |
+#include <string> |
+#include <vector> |
+ |
+#include "base/callback.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/values.h" |
+#include "components/dom_distiller/core/distiller_page.h" |
+#include "url/gurl.h" |
+ |
+namespace dom_distiller { |
+ |
+class DistillerImpl; |
+ |
+struct DistilledPageInfo { |
+ std::string title; |
+ std::string html; |
+ std::string next_page_url; |
+ std::vector<std::string> image_urls; |
+ DistilledPageInfo(); |
+ ~DistilledPageInfo(); |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(DistilledPageInfo); |
+}; |
+ |
+// Distills a single page and |
cjhopman
2014/02/03 21:47:22
and what?
shashi
2014/02/03 23:19:29
Done, typo.
|
+class PageDistiller : public DistillerPage::Delegate { |
+ public: |
+ typedef base::Callback<void(const DistilledPageInfo& distilled_page, |
+ bool distillation_successful)> |
+ PageDistillerCallback; |
+ explicit PageDistiller(const DistillerPageFactory& distiller_page_factory); |
+ virtual ~PageDistiller(); |
+ |
+ // Creates an execution context. This must be called once before any calls are |
+ // made to distill the page. |
+ virtual void Init(); |
+ |
+ virtual void DistillPage(const GURL& url, |
+ const PageDistillerCallback& callback); |
+ |
+ // PageDistillerContext::Delegate |
+ virtual void OnLoadURLDone() OVERRIDE; |
+ virtual void OnExecuteJavaScriptDone(const GURL& page_url, |
+ const base::Value* value) OVERRIDE; |
+ |
+ private: |
+ virtual void LoadURL(const GURL& url); |
+ |
+ // Injects JavaScript to distill a loaded page down to its important content, |
+ // e.g., extracting a news article from its surrounding boilerplate. |
+ void GetDistilledContent(); |
+ |
+ scoped_ptr<DistillerPage> distiller_page_; |
+ PageDistillerCallback page_distiller_callback_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(PageDistiller); |
+}; |
+ |
+} // namespace dom_distiller |
+ |
+#endif // COMPONENTS_DOM_DISTILLER_CORE_PAGE_DISTILLER_H_ |