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 } else { | |
nyquist
2016/02/11 15:57:53
Nit: There's a return-statement in the if-block, s
mvendramini_hp
2016/02/11 19:00:46
Done.
| |
199 return nullptr; | |
200 } | |
201 } | |
202 | |
192 bool DomDistillerService::GetOrCreateTaskTrackerForUrl( | 203 bool DomDistillerService::GetOrCreateTaskTrackerForUrl( |
193 const GURL& url, | 204 const GURL& url, |
194 TaskTracker** task_tracker) { | 205 TaskTracker** task_tracker) { |
195 ArticleEntry entry; | 206 ArticleEntry entry; |
196 if (store_->GetEntryByUrl(url, &entry)) { | 207 if (store_->GetEntryByUrl(url, &entry)) { |
197 return GetOrCreateTaskTrackerForEntry(entry, task_tracker); | 208 return GetOrCreateTaskTrackerForEntry(entry, task_tracker); |
198 } | 209 } |
199 | 210 |
200 *task_tracker = GetTaskTrackerForUrl(url); | 211 *task_tracker = GetTaskTrackerForUrl(url); |
201 if (*task_tracker) { | 212 if (*task_tracker) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
276 void DomDistillerService::RemoveObserver(DomDistillerObserver* observer) { | 287 void DomDistillerService::RemoveObserver(DomDistillerObserver* observer) { |
277 DCHECK(observer); | 288 DCHECK(observer); |
278 store_->RemoveObserver(observer); | 289 store_->RemoveObserver(observer); |
279 } | 290 } |
280 | 291 |
281 DistilledPagePrefs* DomDistillerService::GetDistilledPagePrefs() { | 292 DistilledPagePrefs* DomDistillerService::GetDistilledPagePrefs() { |
282 return distilled_page_prefs_.get(); | 293 return distilled_page_prefs_.get(); |
283 } | 294 } |
284 | 295 |
285 } // namespace dom_distiller | 296 } // namespace dom_distiller |
OLD | NEW |