1 // Copyright 2013 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 COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_
6 #define COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_
11 #include "components/dom_distiller/core/article_entry.h"
12 #include "components/dom_distiller/core/distiller.h"
16 class SyncableService;
19 namespace dom_distiller {
21 class DistillerFactory;
22 class DomDistillerStoreInterface;
25 // A handle to a request to view a DOM distiller entry or URL. The request will
26 // be cancelled when the handle is destroyed.
33 DISALLOW_COPY_AND_ASSIGN(ViewerHandle);
36 // Provide a view of the article list and ways of interacting with it.
37 class DomDistillerService {
39 DomDistillerService(scoped_ptr<DomDistillerStoreInterface> store,
40 scoped_ptr<DistillerFactory> distiller_factory);
41 ~DomDistillerService();
43 syncer::SyncableService* GetSyncableService() const;
45 // Distill the article at |url| and add the resulting entry to the DOM
47 void AddToList(const GURL& url);
49 // Gets the full list of entries.
50 std::vector<ArticleEntry> GetEntries() const;
52 // Request to view an article by entry id. Returns a null pointer if no entry
53 // with |entry_id| exists.
54 scoped_ptr<ViewerHandle> ViewEntry(ViewerContext* context,
55 const std::string& entry_id);
57 // Request to view an article by url.
58 scoped_ptr<ViewerHandle> ViewUrl(ViewerContext* context, const GURL& url);
61 scoped_ptr<DomDistillerStoreInterface> store_;
62 scoped_ptr<DistillerFactory> distiller_factory_;
64 DISALLOW_COPY_AND_ASSIGN(DomDistillerService);
67 } // namespace dom_distiller
69 #endif // COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_