| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_ | 5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_ |
| 6 #define COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_ | 6 #define COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // distiller list. |article_cb| is always invoked, and the bool argument to it | 48 // distiller list. |article_cb| is always invoked, and the bool argument to it |
| 49 // represents whether the article is available offline. | 49 // represents whether the article is available offline. |
| 50 // Use CreateDefaultDistillerPage() to create a default |distiller_page|. | 50 // Use CreateDefaultDistillerPage() to create a default |distiller_page|. |
| 51 // The provided |distiller_page| is only used if there is not already a | 51 // The provided |distiller_page| is only used if there is not already a |
| 52 // distillation task in progress for the given |url|. | 52 // distillation task in progress for the given |url|. |
| 53 virtual const std::string AddToList( | 53 virtual const std::string AddToList( |
| 54 const GURL& url, | 54 const GURL& url, |
| 55 scoped_ptr<DistillerPage> distiller_page, | 55 scoped_ptr<DistillerPage> distiller_page, |
| 56 const ArticleAvailableCallback& article_cb) = 0; | 56 const ArticleAvailableCallback& article_cb) = 0; |
| 57 | 57 |
| 58 // Returns whether an article stored has the given entry id. |
| 59 virtual bool HasEntry(const std::string& entry_id) = 0; |
| 60 |
| 61 // Returns the source URL given an entry ID. If the entry ID article has |
| 62 // multiple pages, this will return the URL of the first page. Returns an |
| 63 // empty string if there is no entry associated with the given entry ID. |
| 64 virtual std::string GetUrlForEntry(const std::string& entry_id) = 0; |
| 65 |
| 58 // Gets the full list of entries. | 66 // Gets the full list of entries. |
| 59 virtual std::vector<ArticleEntry> GetEntries() const = 0; | 67 virtual std::vector<ArticleEntry> GetEntries() const = 0; |
| 60 | 68 |
| 61 // Removes the specified entry from the dom distiller store. | 69 // Removes the specified entry from the dom distiller store. |
| 62 virtual scoped_ptr<ArticleEntry> RemoveEntry(const std::string& entry_id) = 0; | 70 virtual scoped_ptr<ArticleEntry> RemoveEntry(const std::string& entry_id) = 0; |
| 63 | 71 |
| 64 // Request to view an article by entry id. Returns a null pointer if no entry | 72 // Request to view an article by entry id. Returns a null pointer if no entry |
| 65 // with |entry_id| exists. The ViewerHandle should be destroyed before the | 73 // with |entry_id| exists. The ViewerHandle should be destroyed before the |
| 66 // ViewRequestDelegate. The request will be cancelled when the handle is | 74 // ViewRequestDelegate. The request will be cancelled when the handle is |
| 67 // destroyed (or when this service is destroyed), which also ensures that | 75 // destroyed (or when this service is destroyed), which also ensures that |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 scoped_ptr<DistillerPageFactory> distiller_page_factory, | 119 scoped_ptr<DistillerPageFactory> distiller_page_factory, |
| 112 scoped_ptr<DistilledPagePrefs> distilled_page_prefs); | 120 scoped_ptr<DistilledPagePrefs> distilled_page_prefs); |
| 113 virtual ~DomDistillerService(); | 121 virtual ~DomDistillerService(); |
| 114 | 122 |
| 115 // DomDistillerServiceInterface implementation. | 123 // DomDistillerServiceInterface implementation. |
| 116 virtual syncer::SyncableService* GetSyncableService() const OVERRIDE; | 124 virtual syncer::SyncableService* GetSyncableService() const OVERRIDE; |
| 117 virtual const std::string AddToList( | 125 virtual const std::string AddToList( |
| 118 const GURL& url, | 126 const GURL& url, |
| 119 scoped_ptr<DistillerPage> distiller_page, | 127 scoped_ptr<DistillerPage> distiller_page, |
| 120 const ArticleAvailableCallback& article_cb) OVERRIDE; | 128 const ArticleAvailableCallback& article_cb) OVERRIDE; |
| 129 virtual bool HasEntry(const std::string& entry_id) OVERRIDE; |
| 130 virtual std::string GetUrlForEntry(const std::string& entry_id) OVERRIDE; |
| 121 virtual std::vector<ArticleEntry> GetEntries() const OVERRIDE; | 131 virtual std::vector<ArticleEntry> GetEntries() const OVERRIDE; |
| 122 virtual scoped_ptr<ArticleEntry> RemoveEntry( | 132 virtual scoped_ptr<ArticleEntry> RemoveEntry( |
| 123 const std::string& entry_id) OVERRIDE; | 133 const std::string& entry_id) OVERRIDE; |
| 124 virtual scoped_ptr<ViewerHandle> ViewEntry( | 134 virtual scoped_ptr<ViewerHandle> ViewEntry( |
| 125 ViewRequestDelegate* delegate, | 135 ViewRequestDelegate* delegate, |
| 126 scoped_ptr<DistillerPage> distiller_page, | 136 scoped_ptr<DistillerPage> distiller_page, |
| 127 const std::string& entry_id) OVERRIDE; | 137 const std::string& entry_id) OVERRIDE; |
| 128 virtual scoped_ptr<ViewerHandle> ViewUrl( | 138 virtual scoped_ptr<ViewerHandle> ViewUrl( |
| 129 ViewRequestDelegate* delegate, | 139 ViewRequestDelegate* delegate, |
| 130 scoped_ptr<DistillerPage> distiller_page, | 140 scoped_ptr<DistillerPage> distiller_page, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 161 | 171 |
| 162 typedef ScopedVector<TaskTracker> TaskList; | 172 typedef ScopedVector<TaskTracker> TaskList; |
| 163 TaskList tasks_; | 173 TaskList tasks_; |
| 164 | 174 |
| 165 DISALLOW_COPY_AND_ASSIGN(DomDistillerService); | 175 DISALLOW_COPY_AND_ASSIGN(DomDistillerService); |
| 166 }; | 176 }; |
| 167 | 177 |
| 168 } // namespace dom_distiller | 178 } // namespace dom_distiller |
| 169 | 179 |
| 170 #endif // COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_ | 180 #endif // COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_ |
| OLD | NEW |