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

Side by Side Diff: components/dom_distiller/core/dom_distiller_service.h

Issue 189833002: Add a DistilledContentStore (and an in-memory impl) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 DistilledArticleProto; 25 class DistilledArticleProto;
26 class DistilledContentStore;
26 class DistillerFactory; 27 class DistillerFactory;
27 class DomDistillerObserver; 28 class DomDistillerObserver;
28 class DomDistillerStoreInterface; 29 class DomDistillerStoreInterface;
29 class TaskTracker; 30 class TaskTracker;
30 class ViewerHandle; 31 class ViewerHandle;
31 class ViewRequestDelegate; 32 class ViewRequestDelegate;
32 33
33 // Service for interacting with the Dom Distiller. 34 // Service for interacting with the Dom Distiller.
34 // Construction, destruction, and usage of this service must happen on the same 35 // Construction, destruction, and usage of this service must happen on the same
35 // thread. Callbacks will be called on that same thread. 36 // thread. Callbacks will be called on that same thread.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 virtual scoped_ptr<ViewerHandle> ViewUrl(ViewRequestDelegate* delegate, 97 virtual scoped_ptr<ViewerHandle> ViewUrl(ViewRequestDelegate* delegate,
97 const GURL& url) OVERRIDE; 98 const GURL& url) OVERRIDE;
98 virtual void AddObserver(DomDistillerObserver* observer) OVERRIDE; 99 virtual void AddObserver(DomDistillerObserver* observer) OVERRIDE;
99 virtual void RemoveObserver(DomDistillerObserver* observer) OVERRIDE; 100 virtual void RemoveObserver(DomDistillerObserver* observer) OVERRIDE;
100 101
101 private: 102 private:
102 void CancelTask(TaskTracker* task); 103 void CancelTask(TaskTracker* task);
103 void AddDistilledPageToList(const ArticleEntry& entry, 104 void AddDistilledPageToList(const ArticleEntry& entry,
104 const DistilledArticleProto* article_proto, 105 const DistilledArticleProto* article_proto,
105 bool distillation_succeeded); 106 bool distillation_succeeded);
107 void AddDistilledContentToStore(const ArticleEntry& entry,
108 const DistilledArticleProto* article_proto,
109 bool distillation_succeeded);
106 110
107 TaskTracker* CreateTaskTracker(const ArticleEntry& entry); 111 TaskTracker* CreateTaskTracker(const ArticleEntry& entry);
108 112
109 TaskTracker* GetTaskTrackerForEntry(const ArticleEntry& entry) const; 113 TaskTracker* GetTaskTrackerForEntry(const ArticleEntry& entry) const;
110 114
111 // Gets the task tracker for the given |url| or |entry|. If no appropriate 115 // Gets the task tracker for the given |url| or |entry|. If no appropriate
112 // tracker exists, this will create one, initialize it, and add it to 116 // tracker exists, this will create one, initialize it, and add it to
113 // |tasks_|. 117 // |tasks_|.
114 TaskTracker* GetOrCreateTaskTrackerForUrl(const GURL& url); 118 TaskTracker* GetOrCreateTaskTrackerForUrl(const GURL& url);
115 TaskTracker* GetOrCreateTaskTrackerForEntry(const ArticleEntry& entry); 119 TaskTracker* GetOrCreateTaskTrackerForEntry(const ArticleEntry& entry);
116 120
117 scoped_ptr<DomDistillerStoreInterface> store_; 121 scoped_ptr<DomDistillerStoreInterface> store_;
122 scoped_ptr<DistilledContentStore> content_store_;
118 scoped_ptr<DistillerFactory> distiller_factory_; 123 scoped_ptr<DistillerFactory> distiller_factory_;
119 124
120 typedef ScopedVector<TaskTracker> TaskList; 125 typedef ScopedVector<TaskTracker> TaskList;
121 TaskList tasks_; 126 TaskList tasks_;
122 127
123 DISALLOW_COPY_AND_ASSIGN(DomDistillerService); 128 DISALLOW_COPY_AND_ASSIGN(DomDistillerService);
124 }; 129 };
125 130
126 } // namespace dom_distiller 131 } // namespace dom_distiller
127 132
128 #endif // COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_ 133 #endif // COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698