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

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 changes Created 6 years, 6 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/distiller_page.h" 16 #include "components/dom_distiller/core/distiller_page.h"
17 #include "components/dom_distiller/core/reader_mode_preferences.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
26 class DistilledArticleProto; 27 class DistilledArticleProto;
(...skipping 56 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
93 protected: 94 virtual ReaderModePrefs* GetReaderModePrefs();
95 protected:
94 DomDistillerServiceInterface() {} 96 DomDistillerServiceInterface() {}
95 97
96 private: 98 private:
97 DISALLOW_COPY_AND_ASSIGN(DomDistillerServiceInterface); 99 DISALLOW_COPY_AND_ASSIGN(DomDistillerServiceInterface);
98 }; 100 };
99 101
100 // Provide a view of the article list and ways of interacting with it. 102 // Provide a view of the article list and ways of interacting with it.
101 class DomDistillerService : public DomDistillerServiceInterface { 103 class DomDistillerService : public DomDistillerServiceInterface {
102 public: 104 public:
103 DomDistillerService(scoped_ptr<DomDistillerStoreInterface> store, 105 DomDistillerService(scoped_ptr<DomDistillerStoreInterface> store,
104 scoped_ptr<DistillerFactory> distiller_factory, 106 scoped_ptr<DistillerFactory> distiller_factory,
105 scoped_ptr<DistillerPageFactory> distiller_page_factory); 107 scoped_ptr<DistillerPageFactory> distiller_page_factory,
108 scoped_ptr<ReaderModePrefs> reader_mode_prefs);
106 virtual ~DomDistillerService(); 109 virtual ~DomDistillerService();
107 110
108 // DomDistillerServiceInterface implementation. 111 // DomDistillerServiceInterface implementation.
109 virtual syncer::SyncableService* GetSyncableService() const OVERRIDE; 112 virtual syncer::SyncableService* GetSyncableService() const OVERRIDE;
110 virtual const std::string AddToList( 113 virtual const std::string AddToList(
111 const GURL& url, 114 const GURL& url,
112 scoped_ptr<DistillerPage> distiller_page, 115 scoped_ptr<DistillerPage> distiller_page,
113 const ArticleAvailableCallback& article_cb) OVERRIDE; 116 const ArticleAvailableCallback& article_cb) OVERRIDE;
114 virtual std::vector<ArticleEntry> GetEntries() const OVERRIDE; 117 virtual std::vector<ArticleEntry> GetEntries() const OVERRIDE;
115 virtual scoped_ptr<ArticleEntry> RemoveEntry( 118 virtual scoped_ptr<ArticleEntry> RemoveEntry(
116 const std::string& entry_id) OVERRIDE; 119 const std::string& entry_id) OVERRIDE;
117 virtual scoped_ptr<ViewerHandle> ViewEntry( 120 virtual scoped_ptr<ViewerHandle> ViewEntry(
118 ViewRequestDelegate* delegate, 121 ViewRequestDelegate* delegate,
119 scoped_ptr<DistillerPage> distiller_page, 122 scoped_ptr<DistillerPage> distiller_page,
120 const std::string& entry_id) OVERRIDE; 123 const std::string& entry_id) OVERRIDE;
121 virtual scoped_ptr<ViewerHandle> ViewUrl( 124 virtual scoped_ptr<ViewerHandle> ViewUrl(
122 ViewRequestDelegate* delegate, 125 ViewRequestDelegate* delegate,
123 scoped_ptr<DistillerPage> distiller_page, 126 scoped_ptr<DistillerPage> distiller_page,
124 const GURL& url) OVERRIDE; 127 const GURL& url) OVERRIDE;
125 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPage() OVERRIDE; 128 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPage() OVERRIDE;
126 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPageWithHandle( 129 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPageWithHandle(
127 scoped_ptr<SourcePageHandle> handle) OVERRIDE; 130 scoped_ptr<SourcePageHandle> handle) OVERRIDE;
128 virtual void AddObserver(DomDistillerObserver* observer) OVERRIDE; 131 virtual void AddObserver(DomDistillerObserver* observer) OVERRIDE;
129 virtual void RemoveObserver(DomDistillerObserver* observer) OVERRIDE; 132 virtual void RemoveObserver(DomDistillerObserver* observer) OVERRIDE;
133 virtual ReaderModePrefs* GetReaderModePrefs() OVERRIDE;
130 134
131 private: 135 private:
132 void CancelTask(TaskTracker* task); 136 void CancelTask(TaskTracker* task);
133 void AddDistilledPageToList(const ArticleEntry& entry, 137 void AddDistilledPageToList(const ArticleEntry& entry,
134 const DistilledArticleProto* article_proto, 138 const DistilledArticleProto* article_proto,
135 bool distillation_succeeded); 139 bool distillation_succeeded);
136 140
137 TaskTracker* CreateTaskTracker(const ArticleEntry& entry); 141 TaskTracker* CreateTaskTracker(const ArticleEntry& entry);
138 142
139 TaskTracker* GetTaskTrackerForEntry(const ArticleEntry& entry) const; 143 TaskTracker* GetTaskTrackerForEntry(const ArticleEntry& entry) const;
140 144
141 // Gets the task tracker for the given |url| or |entry|. If no appropriate 145 // 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 146 // tracker exists, this will create one, initialize it, and add it to
143 // |tasks_|. 147 // |tasks_|.
144 TaskTracker* GetOrCreateTaskTrackerForUrl(const GURL& url); 148 TaskTracker* GetOrCreateTaskTrackerForUrl(const GURL& url);
145 TaskTracker* GetOrCreateTaskTrackerForEntry(const ArticleEntry& entry); 149 TaskTracker* GetOrCreateTaskTrackerForEntry(const ArticleEntry& entry);
146 150
147 scoped_ptr<DomDistillerStoreInterface> store_; 151 scoped_ptr<DomDistillerStoreInterface> store_;
148 scoped_ptr<DistilledContentStore> content_store_; 152 scoped_ptr<DistilledContentStore> content_store_;
149 scoped_ptr<DistillerFactory> distiller_factory_; 153 scoped_ptr<DistillerFactory> distiller_factory_;
150 scoped_ptr<DistillerPageFactory> distiller_page_factory_; 154 scoped_ptr<DistillerPageFactory> distiller_page_factory_;
155 scoped_ptr<ReaderModePrefs> reader_mode_prefs_;
151 156
152 typedef ScopedVector<TaskTracker> TaskList; 157 typedef ScopedVector<TaskTracker> TaskList;
153 TaskList tasks_; 158 TaskList tasks_;
154 159
155 DISALLOW_COPY_AND_ASSIGN(DomDistillerService); 160 DISALLOW_COPY_AND_ASSIGN(DomDistillerService);
156 }; 161 };
157 162
158 } // namespace dom_distiller 163 } // namespace dom_distiller
159 164
160 #endif // COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_ 165 #endif // COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698