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" |
11 #include "base/message_loop/message_loop.h" | |
12 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
13 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
14 #include "components/dom_distiller/core/distilled_content_store.h" | 13 #include "components/dom_distiller/core/distilled_content_store.h" |
15 #include "components/dom_distiller/core/dom_distiller_store.h" | 14 #include "components/dom_distiller/core/dom_distiller_store.h" |
16 #include "components/dom_distiller/core/proto/distilled_article.pb.h" | 15 #include "components/dom_distiller/core/proto/distilled_article.pb.h" |
17 #include "components/dom_distiller/core/task_tracker.h" | 16 #include "components/dom_distiller/core/task_tracker.h" |
18 #include "url/gurl.h" | 17 #include "url/gurl.h" |
19 | 18 |
20 namespace dom_distiller { | 19 namespace dom_distiller { |
21 | 20 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 TaskTracker* tracker = | 245 TaskTracker* tracker = |
247 new TaskTracker(entry, cancel_callback, content_store_.get()); | 246 new TaskTracker(entry, cancel_callback, content_store_.get()); |
248 tasks_.push_back(tracker); | 247 tasks_.push_back(tracker); |
249 return tracker; | 248 return tracker; |
250 } | 249 } |
251 | 250 |
252 void DomDistillerService::CancelTask(TaskTracker* task) { | 251 void DomDistillerService::CancelTask(TaskTracker* task) { |
253 TaskList::iterator it = std::find(tasks_.begin(), tasks_.end(), task); | 252 TaskList::iterator it = std::find(tasks_.begin(), tasks_.end(), task); |
254 if (it != tasks_.end()) { | 253 if (it != tasks_.end()) { |
255 tasks_.weak_erase(it); | 254 tasks_.weak_erase(it); |
256 base::MessageLoop::current()->DeleteSoon(FROM_HERE, task); | 255 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, task); |
257 } | 256 } |
258 } | 257 } |
259 | 258 |
260 void DomDistillerService::AddDistilledPageToList( | 259 void DomDistillerService::AddDistilledPageToList( |
261 const ArticleEntry& entry, | 260 const ArticleEntry& entry, |
262 const DistilledArticleProto* article_proto, | 261 const DistilledArticleProto* article_proto, |
263 bool distillation_succeeded) { | 262 bool distillation_succeeded) { |
264 DCHECK(IsEntryValid(entry)); | 263 DCHECK(IsEntryValid(entry)); |
265 if (distillation_succeeded) { | 264 if (distillation_succeeded) { |
266 DCHECK(article_proto); | 265 DCHECK(article_proto); |
(...skipping 11 matching lines...) Expand all Loading... |
278 void DomDistillerService::RemoveObserver(DomDistillerObserver* observer) { | 277 void DomDistillerService::RemoveObserver(DomDistillerObserver* observer) { |
279 DCHECK(observer); | 278 DCHECK(observer); |
280 store_->RemoveObserver(observer); | 279 store_->RemoveObserver(observer); |
281 } | 280 } |
282 | 281 |
283 DistilledPagePrefs* DomDistillerService::GetDistilledPagePrefs() { | 282 DistilledPagePrefs* DomDistillerService::GetDistilledPagePrefs() { |
284 return distilled_page_prefs_.get(); | 283 return distilled_page_prefs_.get(); |
285 } | 284 } |
286 | 285 |
287 } // namespace dom_distiller | 286 } // namespace dom_distiller |
OLD | NEW |