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

Unified Diff: components/dom_distiller/core/distiller_page.h

Issue 254483003: Start requiring DistillerPage for calls to DomDistillerService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Indent fixes (full git cl format) Created 6 years, 8 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 | « components/dom_distiller/core/distiller.cc ('k') | components/dom_distiller/core/distiller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/dom_distiller/core/distiller_page.h
diff --git a/components/dom_distiller/core/distiller_page.h b/components/dom_distiller/core/distiller_page.h
index d0d82228238c70e6b48827f14188536fc093fa4c..a30d5e79d67e2f71f0ec41ce3ea23d820799188b 100644
--- a/components/dom_distiller/core/distiller_page.h
+++ b/components/dom_distiller/core/distiller_page.h
@@ -31,6 +31,8 @@ struct DistilledPageInfo {
// Injects JavaScript into a page, and uses it to extract and return long-form
// content. The class can be reused to load and distill multiple pages,
// following the state transitions described along with the class's states.
+// Constructing a DistillerPage should be cheap, as some of the instances can be
+// thrown away without ever being used.
class DistillerPage {
public:
typedef base::Callback<void(scoped_ptr<DistilledPageInfo> distilled_page,
@@ -41,7 +43,9 @@ class DistillerPage {
virtual ~DistillerPage();
// Loads a URL. |OnDistillationDone| is called when the load completes or
- // fails. May be called when the distiller is idle.
+ // fails. May be called when the distiller is idle. Callers can assume that,
+ // for a given |url|, any DistillerPage implementation will extract the same
+ // content.
void DistillPage(const GURL& url, const DistillerPageCallback& callback);
// Called when the JavaScript execution completes. |page_url| is the url of
@@ -51,8 +55,9 @@ class DistillerPage {
protected:
// Called by |DistillPage| to carry out platform-specific instructions to load
- // a page.
- virtual void DistillPageImpl(const GURL& gurl, const std::string& script) = 0;
+ // and distill the |url| using the provided |script|. The extracted content
+ // should be the same regardless of the DistillerPage implementation.
+ virtual void DistillPageImpl(const GURL& url, const std::string& script) = 0;
// Called by |ExecuteJavaScript| to carry out platform-specific instructions
// to inject and execute JavaScript within the context of the loaded page.
@@ -69,6 +74,9 @@ class DistillerPageFactory {
public:
virtual ~DistillerPageFactory();
+ // Constructs and returns a new DistillerPage. The implementation of this
+ // should be very cheap, since the pages can be thrown away without being
+ // used.
virtual scoped_ptr<DistillerPage> CreateDistillerPage() const = 0;
};
« no previous file with comments | « components/dom_distiller/core/distiller.cc ('k') | components/dom_distiller/core/distiller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698