Chromium Code Reviews| 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 = nullptr; | |
| 196 GetOrCreateTaskTrackerForUrl(url, &task_tracker); | |
| 197 scoped_ptr<ViewerHandle> viewer_handle = task_tracker->AddViewer(delegate); | |
|
Bernhard Bauer
2016/01/19 17:21:02
You can just directly return this.
mvendramini_hp
2016/01/20 11:56:57
Done.
| |
| 198 return viewer_handle; | |
| 199 } | |
| 200 | |
| 192 bool DomDistillerService::GetOrCreateTaskTrackerForUrl( | 201 bool DomDistillerService::GetOrCreateTaskTrackerForUrl( |
| 193 const GURL& url, | 202 const GURL& url, |
| 194 TaskTracker** task_tracker) { | 203 TaskTracker** task_tracker) { |
| 195 ArticleEntry entry; | 204 ArticleEntry entry; |
| 196 if (store_->GetEntryByUrl(url, &entry)) { | 205 if (store_->GetEntryByUrl(url, &entry)) { |
| 197 return GetOrCreateTaskTrackerForEntry(entry, task_tracker); | 206 return GetOrCreateTaskTrackerForEntry(entry, task_tracker); |
| 198 } | 207 } |
| 199 | 208 |
| 200 *task_tracker = GetTaskTrackerForUrl(url); | 209 *task_tracker = GetTaskTrackerForUrl(url); |
| 201 if (*task_tracker) { | 210 if (*task_tracker) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 void DomDistillerService::RemoveObserver(DomDistillerObserver* observer) { | 285 void DomDistillerService::RemoveObserver(DomDistillerObserver* observer) { |
| 277 DCHECK(observer); | 286 DCHECK(observer); |
| 278 store_->RemoveObserver(observer); | 287 store_->RemoveObserver(observer); |
| 279 } | 288 } |
| 280 | 289 |
| 281 DistilledPagePrefs* DomDistillerService::GetDistilledPagePrefs() { | 290 DistilledPagePrefs* DomDistillerService::GetDistilledPagePrefs() { |
| 282 return distilled_page_prefs_.get(); | 291 return distilled_page_prefs_.get(); |
| 283 } | 292 } |
| 284 | 293 |
| 285 } // namespace dom_distiller | 294 } // namespace dom_distiller |
| OLD | NEW |