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

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

Issue 1575473002: Improve syncing between dom distiller and the print preview request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: expanded internal new api doc, some adjustments to the feature's internal mechanism Created 4 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
Index: components/dom_distiller/core/dom_distiller_service.h
diff --git a/components/dom_distiller/core/dom_distiller_service.h b/components/dom_distiller/core/dom_distiller_service.h
index 5d2558d1142b68467f6434f8b538663a16cd7762..3d9f7f9d079217453435abb92067171657c04089 100644
--- a/components/dom_distiller/core/dom_distiller_service.h
+++ b/components/dom_distiller/core/dom_distiller_service.h
@@ -92,6 +92,38 @@ class DomDistillerServiceInterface {
scoped_ptr<DistillerPage> distiller_page,
const GURL& url) = 0;
+ // Adds |delegate| to the provided |url| task tracker.
+ // If the given |url| has no task tracker (i.e. has no current
+ // distillation request underway), this will return nullptr - therefore
+ // this should only be called after previously requesting a distillation.
+
+ // If the inclusion of |delegate| on the |url| task tracker was
+ // successful, returns a |ViewerHandle| from the task tracker. This
+ // |ViewerHandle| can be held by client code as long as it wants to
+ // receive callbacks as a |ViewRequestDelegate|.
+
+ // Upon successful inclusion (i.e. a |ViewerHandle| was returned),
+ // the following holds:
+ //
+ // 1) client code will get all future OnArticleUpdated() callbacks for
+ // as long as the distillation process is running.
+ //
+ // 2) client code will get at least the OnArticleFinished()
+ // callback, considering:
+ // 2.a) If the article distillation is not finished yet, the
+ // callback will trigger at the same time as when the original
+ // distillation request gets it.
+ // 2.b) Client code will immediately get this callback after adding
+ // the viewer. If the original distillation request has already
+ // gotten this callback, it has also previously posted it
+ // to a valid standing task tracker.
+
+ // If the inclusion was not successful (i.e. this function
+ // returned nullptr), client code will not get any callbacks.
+ virtual scoped_ptr<ViewerHandle> AddViewRequestDelegate(
+ ViewRequestDelegate* delegate,
+ const GURL& url) = 0;
+
// Creates a default DistillerPage.
virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPage(
const gfx::Size& render_view_size) = 0;
@@ -137,6 +169,8 @@ class DomDistillerService : public DomDistillerServiceInterface {
scoped_ptr<ViewerHandle> ViewUrl(ViewRequestDelegate* delegate,
scoped_ptr<DistillerPage> distiller_page,
const GURL& url) override;
+ scoped_ptr<ViewerHandle> AddViewRequestDelegate(ViewRequestDelegate* delegate,
+ const GURL& url) override;
scoped_ptr<DistillerPage> CreateDefaultDistillerPage(
const gfx::Size& render_view_size) override;
scoped_ptr<DistillerPage> CreateDefaultDistillerPageWithHandle(

Powered by Google App Engine
This is Rietveld 408576698