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 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "components/dom_distiller/core/article_entry.h" | 15 #include "components/dom_distiller/core/article_entry.h" |
16 | 16 |
17 class GURL; | 17 class GURL; |
18 | 18 |
19 namespace syncer { | 19 namespace syncer { |
20 class SyncableService; | 20 class SyncableService; |
21 } | 21 } |
22 | 22 |
23 namespace dom_distiller { | 23 namespace dom_distiller { |
24 | 24 |
25 class DistilledPageProto; | 25 class DistilledArticleProto; |
26 class DistillerFactory; | 26 class DistillerFactory; |
27 class DomDistillerObserver; | 27 class DomDistillerObserver; |
28 class DomDistillerStoreInterface; | 28 class DomDistillerStoreInterface; |
29 class TaskTracker; | 29 class TaskTracker; |
30 class ViewerHandle; | 30 class ViewerHandle; |
31 class ViewRequestDelegate; | 31 class ViewRequestDelegate; |
32 | 32 |
33 // Provide a view of the article list and ways of interacting with it. | 33 // Provide a view of the article list and ways of interacting with it. |
34 class DomDistillerService { | 34 class DomDistillerService { |
35 public: | 35 public: |
(...skipping 27 matching lines...) Expand all Loading... |
63 // Request to view an article by url. | 63 // Request to view an article by url. |
64 scoped_ptr<ViewerHandle> ViewUrl(ViewRequestDelegate* delegate, | 64 scoped_ptr<ViewerHandle> ViewUrl(ViewRequestDelegate* delegate, |
65 const GURL& url); | 65 const GURL& url); |
66 | 66 |
67 void AddObserver(DomDistillerObserver* observer); | 67 void AddObserver(DomDistillerObserver* observer); |
68 void RemoveObserver(DomDistillerObserver* observer); | 68 void RemoveObserver(DomDistillerObserver* observer); |
69 | 69 |
70 private: | 70 private: |
71 void CancelTask(TaskTracker* task); | 71 void CancelTask(TaskTracker* task); |
72 void AddDistilledPageToList(const ArticleEntry& entry, | 72 void AddDistilledPageToList(const ArticleEntry& entry, |
73 DistilledPageProto* proto, | 73 const DistilledArticleProto* article_proto, |
74 bool distillation_succeeded); | 74 bool distillation_succeeded); |
75 | 75 |
76 TaskTracker* CreateTaskTracker(const ArticleEntry& entry); | 76 TaskTracker* CreateTaskTracker(const ArticleEntry& entry); |
77 | 77 |
78 TaskTracker* GetTaskTrackerForEntry(const ArticleEntry& entry) const; | 78 TaskTracker* GetTaskTrackerForEntry(const ArticleEntry& entry) const; |
79 | 79 |
80 // Gets the task tracker for the given |url| or |entry|. If no appropriate | 80 // Gets the task tracker for the given |url| or |entry|. If no appropriate |
81 // tracker exists, this will create one, initialize it, and add it to | 81 // tracker exists, this will create one, initialize it, and add it to |
82 // |tasks_|. | 82 // |tasks_|. |
83 TaskTracker* GetOrCreateTaskTrackerForUrl(const GURL& url); | 83 TaskTracker* GetOrCreateTaskTrackerForUrl(const GURL& url); |
84 TaskTracker* GetOrCreateTaskTrackerForEntry(const ArticleEntry& entry); | 84 TaskTracker* GetOrCreateTaskTrackerForEntry(const ArticleEntry& entry); |
85 | 85 |
86 scoped_ptr<DomDistillerStoreInterface> store_; | 86 scoped_ptr<DomDistillerStoreInterface> store_; |
87 scoped_ptr<DistillerFactory> distiller_factory_; | 87 scoped_ptr<DistillerFactory> distiller_factory_; |
88 | 88 |
89 typedef ScopedVector<TaskTracker> TaskList; | 89 typedef ScopedVector<TaskTracker> TaskList; |
90 TaskList tasks_; | 90 TaskList tasks_; |
91 | 91 |
92 DISALLOW_COPY_AND_ASSIGN(DomDistillerService); | 92 DISALLOW_COPY_AND_ASSIGN(DomDistillerService); |
93 }; | 93 }; |
94 | 94 |
95 } // namespace dom_distiller | 95 } // namespace dom_distiller |
96 | 96 |
97 #endif // COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_ | 97 #endif // COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_ |
OLD | NEW |