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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 | 85 |
86 // Request to view an article by url. | 86 // Request to view an article by url. |
87 // Use CreateDefaultDistillerPage() to create a default |distiller_page|. | 87 // Use CreateDefaultDistillerPage() to create a default |distiller_page|. |
88 // The provided |distiller_page| is only used if there is not already a | 88 // The provided |distiller_page| is only used if there is not already a |
89 // distillation task in progress for the given |url|. | 89 // distillation task in progress for the given |url|. |
90 virtual scoped_ptr<ViewerHandle> ViewUrl( | 90 virtual scoped_ptr<ViewerHandle> ViewUrl( |
91 ViewRequestDelegate* delegate, | 91 ViewRequestDelegate* delegate, |
92 scoped_ptr<DistillerPage> distiller_page, | 92 scoped_ptr<DistillerPage> distiller_page, |
93 const GURL& url) = 0; | 93 const GURL& url) = 0; |
94 | 94 |
95 // Adds |delegate| to the provided |url| task tracker. | |
96 // If the given |url| has no task tracker (i.e. has no current | |
97 // distillation request underway), this will return nullptr - therefore | |
98 // this should only be called after previously requesting a distillation. | |
99 // If the inclusion of |delegate| on the |url| task tracker was | |
100 // successful, returns a |ViewerHandle| from the task tracker. This | |
101 // |ViewerHandle| can be held by client code as long as it wants to | |
102 // receive callbacks as a |ViewRequestDelegate|. | |
nyquist
2016/02/11 15:57:53
Could you expand this comment with a sentence abou
mvendramini_hp
2016/02/11 19:00:46
I propose we either cross-reference the callbacks
nyquist
2016/02/17 23:09:38
So, the guarantee is:
- If this function returns n
mvendramini_hp
2016/02/18 12:27:02
Done, expanded the doc-comment, please check it ou
| |
103 virtual scoped_ptr<ViewerHandle> AddViewRequestDelegate( | |
104 ViewRequestDelegate* delegate, | |
105 const GURL& url) = 0; | |
106 | |
95 // Creates a default DistillerPage. | 107 // Creates a default DistillerPage. |
96 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPage( | 108 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPage( |
97 const gfx::Size& render_view_size) = 0; | 109 const gfx::Size& render_view_size) = 0; |
98 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPageWithHandle( | 110 virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPageWithHandle( |
99 scoped_ptr<SourcePageHandle> handle) = 0; | 111 scoped_ptr<SourcePageHandle> handle) = 0; |
100 | 112 |
101 virtual void AddObserver(DomDistillerObserver* observer) = 0; | 113 virtual void AddObserver(DomDistillerObserver* observer) = 0; |
102 virtual void RemoveObserver(DomDistillerObserver* observer) = 0; | 114 virtual void RemoveObserver(DomDistillerObserver* observer) = 0; |
103 | 115 |
104 // Returns the DistilledPagePrefs owned by the instance of | 116 // Returns the DistilledPagePrefs owned by the instance of |
(...skipping 25 matching lines...) Expand all Loading... | |
130 bool HasEntry(const std::string& entry_id) override; | 142 bool HasEntry(const std::string& entry_id) override; |
131 std::string GetUrlForEntry(const std::string& entry_id) override; | 143 std::string GetUrlForEntry(const std::string& entry_id) override; |
132 std::vector<ArticleEntry> GetEntries() const override; | 144 std::vector<ArticleEntry> GetEntries() const override; |
133 scoped_ptr<ArticleEntry> RemoveEntry(const std::string& entry_id) override; | 145 scoped_ptr<ArticleEntry> RemoveEntry(const std::string& entry_id) override; |
134 scoped_ptr<ViewerHandle> ViewEntry(ViewRequestDelegate* delegate, | 146 scoped_ptr<ViewerHandle> ViewEntry(ViewRequestDelegate* delegate, |
135 scoped_ptr<DistillerPage> distiller_page, | 147 scoped_ptr<DistillerPage> distiller_page, |
136 const std::string& entry_id) override; | 148 const std::string& entry_id) override; |
137 scoped_ptr<ViewerHandle> ViewUrl(ViewRequestDelegate* delegate, | 149 scoped_ptr<ViewerHandle> ViewUrl(ViewRequestDelegate* delegate, |
138 scoped_ptr<DistillerPage> distiller_page, | 150 scoped_ptr<DistillerPage> distiller_page, |
139 const GURL& url) override; | 151 const GURL& url) override; |
152 scoped_ptr<ViewerHandle> AddViewRequestDelegate(ViewRequestDelegate* delegate, | |
153 const GURL& url) override; | |
140 scoped_ptr<DistillerPage> CreateDefaultDistillerPage( | 154 scoped_ptr<DistillerPage> CreateDefaultDistillerPage( |
141 const gfx::Size& render_view_size) override; | 155 const gfx::Size& render_view_size) override; |
142 scoped_ptr<DistillerPage> CreateDefaultDistillerPageWithHandle( | 156 scoped_ptr<DistillerPage> CreateDefaultDistillerPageWithHandle( |
143 scoped_ptr<SourcePageHandle> handle) override; | 157 scoped_ptr<SourcePageHandle> handle) override; |
144 void AddObserver(DomDistillerObserver* observer) override; | 158 void AddObserver(DomDistillerObserver* observer) override; |
145 void RemoveObserver(DomDistillerObserver* observer) override; | 159 void RemoveObserver(DomDistillerObserver* observer) override; |
146 DistilledPagePrefs* GetDistilledPagePrefs() override; | 160 DistilledPagePrefs* GetDistilledPagePrefs() override; |
147 | 161 |
148 private: | 162 private: |
149 void CancelTask(TaskTracker* task); | 163 void CancelTask(TaskTracker* task); |
(...skipping 24 matching lines...) Expand all Loading... | |
174 | 188 |
175 typedef ScopedVector<TaskTracker> TaskList; | 189 typedef ScopedVector<TaskTracker> TaskList; |
176 TaskList tasks_; | 190 TaskList tasks_; |
177 | 191 |
178 DISALLOW_COPY_AND_ASSIGN(DomDistillerService); | 192 DISALLOW_COPY_AND_ASSIGN(DomDistillerService); |
179 }; | 193 }; |
180 | 194 |
181 } // namespace dom_distiller | 195 } // namespace dom_distiller |
182 | 196 |
183 #endif // COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_ | 197 #endif // COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_SERVICE_H_ |
OLD | NEW |