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 #include "components/dom_distiller/core/dom_distiller_service.h" | 5 #include "components/dom_distiller/core/dom_distiller_service.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/guid.h" | 9 #include "base/guid.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // If a distiller is already running for one URL, don't start another. | 182 // If a distiller is already running for one URL, don't start another. |
183 if (was_created) { | 183 if (was_created) { |
184 task_tracker->StartDistiller(distiller_factory_.get(), | 184 task_tracker->StartDistiller(distiller_factory_.get(), |
185 std::move(distiller_page)); | 185 std::move(distiller_page)); |
186 task_tracker->StartBlobFetcher(); | 186 task_tracker->StartBlobFetcher(); |
187 } | 187 } |
188 | 188 |
189 return viewer_handle; | 189 return viewer_handle; |
190 } | 190 } |
191 | 191 |
| 192 scoped_ptr<ViewerHandle> DomDistillerService::AddViewRequestDelegate( |
| 193 ViewRequestDelegate* delegate, |
| 194 const GURL& url) { |
| 195 TaskTracker* task_tracker = GetTaskTrackerForUrl(url); |
| 196 if (task_tracker) |
| 197 return task_tracker->AddViewer(delegate); |
| 198 |
| 199 return nullptr; |
| 200 } |
| 201 |
192 bool DomDistillerService::GetOrCreateTaskTrackerForUrl( | 202 bool DomDistillerService::GetOrCreateTaskTrackerForUrl( |
193 const GURL& url, | 203 const GURL& url, |
194 TaskTracker** task_tracker) { | 204 TaskTracker** task_tracker) { |
195 ArticleEntry entry; | 205 ArticleEntry entry; |
196 if (store_->GetEntryByUrl(url, &entry)) { | 206 if (store_->GetEntryByUrl(url, &entry)) { |
197 return GetOrCreateTaskTrackerForEntry(entry, task_tracker); | 207 return GetOrCreateTaskTrackerForEntry(entry, task_tracker); |
198 } | 208 } |
199 | 209 |
200 *task_tracker = GetTaskTrackerForUrl(url); | 210 *task_tracker = GetTaskTrackerForUrl(url); |
201 if (*task_tracker) { | 211 if (*task_tracker) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 void DomDistillerService::RemoveObserver(DomDistillerObserver* observer) { | 286 void DomDistillerService::RemoveObserver(DomDistillerObserver* observer) { |
277 DCHECK(observer); | 287 DCHECK(observer); |
278 store_->RemoveObserver(observer); | 288 store_->RemoveObserver(observer); |
279 } | 289 } |
280 | 290 |
281 DistilledPagePrefs* DomDistillerService::GetDistilledPagePrefs() { | 291 DistilledPagePrefs* DomDistillerService::GetDistilledPagePrefs() { |
282 return distilled_page_prefs_.get(); | 292 return distilled_page_prefs_.get(); |
283 } | 293 } |
284 | 294 |
285 } // namespace dom_distiller | 295 } // namespace dom_distiller |
OLD | NEW |