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

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

Issue 341563002: Theme Preferences for Distilled Pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor change - dependency order Created 6 years, 5 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 #include "components/dom_distiller/core/distilled_page_prefs.h"
16 #include "components/dom_distiller/core/distiller_page.h" 17 #include "components/dom_distiller/core/distiller_page.h"
17 18
18 class GURL; 19 class GURL;
19 20
20 namespace syncer { 21 namespace syncer {
21 class SyncableService; 22 class SyncableService;
22 } 23 }
23 24
24 namespace dom_distiller { 25 namespace dom_distiller {
25 26
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 const GURL& url) = 0; 84 const GURL& url) = 0;
84 85
85 // Creates a default DistillerPage. 86 // Creates a default DistillerPage.
86 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPage() = 0; 87 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPage() = 0;
87 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPageWithHandle( 88 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPageWithHandle(
88 scoped_ptr<SourcePageHandle> handle) = 0; 89 scoped_ptr<SourcePageHandle> handle) = 0;
89 90
90 virtual void AddObserver(DomDistillerObserver* observer) = 0; 91 virtual void AddObserver(DomDistillerObserver* observer) = 0;
91 virtual void RemoveObserver(DomDistillerObserver* observer) = 0; 92 virtual void RemoveObserver(DomDistillerObserver* observer) = 0;
92 93
94 // Returns the DistilledPagePrefs owned by the instance of
95 // DomDistillerService.
96 virtual DistilledPagePrefs* GetDistilledPagePrefs() = 0;
97
93 protected: 98 protected:
94 DomDistillerServiceInterface() {} 99 DomDistillerServiceInterface() {}
95 100
96 private: 101 private:
97 DISALLOW_COPY_AND_ASSIGN(DomDistillerServiceInterface); 102 DISALLOW_COPY_AND_ASSIGN(DomDistillerServiceInterface);
98 }; 103 };
99 104
100 // Provide a view of the article list and ways of interacting with it. 105 // Provide a view of the article list and ways of interacting with it.
101 class DomDistillerService : public DomDistillerServiceInterface { 106 class DomDistillerService : public DomDistillerServiceInterface {
102 public: 107 public:
103 DomDistillerService(scoped_ptr<DomDistillerStoreInterface> store, 108 DomDistillerService(scoped_ptr<DomDistillerStoreInterface> store,
104 scoped_ptr<DistillerFactory> distiller_factory, 109 scoped_ptr<DistillerFactory> distiller_factory,
105 scoped_ptr<DistillerPageFactory> distiller_page_factory); 110 scoped_ptr<DistillerPageFactory> distiller_page_factory,
111 scoped_ptr<DistilledPagePrefs> distilled_page_prefs);
106 virtual ~DomDistillerService(); 112 virtual ~DomDistillerService();
107 113
108 // DomDistillerServiceInterface implementation. 114 // DomDistillerServiceInterface implementation.
109 virtual syncer::SyncableService* GetSyncableService() const OVERRIDE; 115 virtual syncer::SyncableService* GetSyncableService() const OVERRIDE;
110 virtual const std::string AddToList( 116 virtual const std::string AddToList(
111 const GURL& url, 117 const GURL& url,
112 scoped_ptr<DistillerPage> distiller_page, 118 scoped_ptr<DistillerPage> distiller_page,
113 const ArticleAvailableCallback& article_cb) OVERRIDE; 119 const ArticleAvailableCallback& article_cb) OVERRIDE;
114 virtual std::vector<ArticleEntry> GetEntries() const OVERRIDE; 120 virtual std::vector<ArticleEntry> GetEntries() const OVERRIDE;
115 virtual scoped_ptr<ArticleEntry> RemoveEntry( 121 virtual scoped_ptr<ArticleEntry> RemoveEntry(
116 const std::string& entry_id) OVERRIDE; 122 const std::string& entry_id) OVERRIDE;
117 virtual scoped_ptr<ViewerHandle> ViewEntry( 123 virtual scoped_ptr<ViewerHandle> ViewEntry(
118 ViewRequestDelegate* delegate, 124 ViewRequestDelegate* delegate,
119 scoped_ptr<DistillerPage> distiller_page, 125 scoped_ptr<DistillerPage> distiller_page,
120 const std::string& entry_id) OVERRIDE; 126 const std::string& entry_id) OVERRIDE;
121 virtual scoped_ptr<ViewerHandle> ViewUrl( 127 virtual scoped_ptr<ViewerHandle> ViewUrl(
122 ViewRequestDelegate* delegate, 128 ViewRequestDelegate* delegate,
123 scoped_ptr<DistillerPage> distiller_page, 129 scoped_ptr<DistillerPage> distiller_page,
124 const GURL& url) OVERRIDE; 130 const GURL& url) OVERRIDE;
125 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPage() OVERRIDE; 131 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPage() OVERRIDE;
126 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPageWithHandle( 132 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPageWithHandle(
127 scoped_ptr<SourcePageHandle> handle) OVERRIDE; 133 scoped_ptr<SourcePageHandle> handle) OVERRIDE;
128 virtual void AddObserver(DomDistillerObserver* observer) OVERRIDE; 134 virtual void AddObserver(DomDistillerObserver* observer) OVERRIDE;
129 virtual void RemoveObserver(DomDistillerObserver* observer) OVERRIDE; 135 virtual void RemoveObserver(DomDistillerObserver* observer) OVERRIDE;
136 virtual DistilledPagePrefs* GetDistilledPagePrefs() OVERRIDE;
130 137
131 private: 138 private:
132 void CancelTask(TaskTracker* task); 139 void CancelTask(TaskTracker* task);
133 void AddDistilledPageToList(const ArticleEntry& entry, 140 void AddDistilledPageToList(const ArticleEntry& entry,
134 const DistilledArticleProto* article_proto, 141 const DistilledArticleProto* article_proto,
135 bool distillation_succeeded); 142 bool distillation_succeeded);
136 143
137 TaskTracker* CreateTaskTracker(const ArticleEntry& entry); 144 TaskTracker* CreateTaskTracker(const ArticleEntry& entry);
138 145
139 TaskTracker* GetTaskTrackerForEntry(const ArticleEntry& entry) const; 146 TaskTracker* GetTaskTrackerForEntry(const ArticleEntry& entry) const;
140 147
141 // Gets the task tracker for the given |url| or |entry|. If no appropriate 148 // Gets the task tracker for the given |url| or |entry|. If no appropriate
142 // tracker exists, this will create one, initialize it, and add it to 149 // tracker exists, this will create one, initialize it, and add it to
143 // |tasks_|. 150 // |tasks_|.
144 TaskTracker* GetOrCreateTaskTrackerForUrl(const GURL& url); 151 TaskTracker* GetOrCreateTaskTrackerForUrl(const GURL& url);
145 TaskTracker* GetOrCreateTaskTrackerForEntry(const ArticleEntry& entry); 152 TaskTracker* GetOrCreateTaskTrackerForEntry(const ArticleEntry& entry);
146 153
147 scoped_ptr<DomDistillerStoreInterface> store_; 154 scoped_ptr<DomDistillerStoreInterface> store_;
148 scoped_ptr<DistilledContentStore> content_store_; 155 scoped_ptr<DistilledContentStore> content_store_;
149 scoped_ptr<DistillerFactory> distiller_factory_; 156 scoped_ptr<DistillerFactory> distiller_factory_;
150 scoped_ptr<DistillerPageFactory> distiller_page_factory_; 157 scoped_ptr<DistillerPageFactory> distiller_page_factory_;
158 scoped_ptr<DistilledPagePrefs> distilled_page_prefs_;
151 159
152 typedef ScopedVector<TaskTracker> TaskList; 160 typedef ScopedVector<TaskTracker> TaskList;
153 TaskList tasks_; 161 TaskList tasks_;
154 162
155 DISALLOW_COPY_AND_ASSIGN(DomDistillerService); 163 DISALLOW_COPY_AND_ASSIGN(DomDistillerService);
156 }; 164 };
157 165
158 } // namespace dom_distiller 166 } // namespace dom_distiller
159 167
160 #endif // COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_ 168 #endif // COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698