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 "base/guid.h" | 7 #include "base/guid.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "components/dom_distiller/core/distilled_content_store.h" | 9 #include "components/dom_distiller/core/distilled_content_store.h" |
10 #include "components/dom_distiller/core/dom_distiller_store.h" | 10 #include "components/dom_distiller/core/dom_distiller_store.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 DomDistillerService::DomDistillerService( | 39 DomDistillerService::DomDistillerService( |
40 scoped_ptr<DomDistillerStoreInterface> store, | 40 scoped_ptr<DomDistillerStoreInterface> store, |
41 scoped_ptr<DistillerFactory> distiller_factory, | 41 scoped_ptr<DistillerFactory> distiller_factory, |
42 scoped_ptr<DistillerPageFactory> distiller_page_factory) | 42 scoped_ptr<DistillerPageFactory> distiller_page_factory) |
43 : store_(store.Pass()), | 43 : store_(store.Pass()), |
44 content_store_(new InMemoryContentStore()), | 44 content_store_(new InMemoryContentStore()), |
45 distiller_factory_(distiller_factory.Pass()), | 45 distiller_factory_(distiller_factory.Pass()), |
46 distiller_page_factory_(distiller_page_factory.Pass()) { | 46 distiller_page_factory_(distiller_page_factory.Pass()) { |
47 } | 47 } |
48 | 48 |
49 DomDistillerService::~DomDistillerService() {} | 49 DomDistillerService::~DomDistillerService() { |
| 50 } |
50 | 51 |
51 syncer::SyncableService* DomDistillerService::GetSyncableService() const { | 52 syncer::SyncableService* DomDistillerService::GetSyncableService() const { |
52 return store_->GetSyncableService(); | 53 return store_->GetSyncableService(); |
53 } | 54 } |
54 | 55 |
55 scoped_ptr<DistillerPage> DomDistillerService::CreateDefaultDistillerPage() { | 56 scoped_ptr<DistillerPage> DomDistillerService::CreateDefaultDistillerPage() { |
56 return distiller_page_factory_->CreateDistillerPage().Pass(); | 57 return distiller_page_factory_->CreateDistillerPage().Pass(); |
57 } | 58 } |
58 | 59 |
| 60 scoped_ptr<DistillerPage> |
| 61 DomDistillerService::CreateDefaultDistillerPageWithHandle( |
| 62 scoped_ptr<SourcePageHandle> handle) { |
| 63 return distiller_page_factory_->CreateDistillerPageWithHandle(handle.Pass()) |
| 64 .Pass(); |
| 65 } |
| 66 |
59 const std::string DomDistillerService::AddToList( | 67 const std::string DomDistillerService::AddToList( |
60 const GURL& url, | 68 const GURL& url, |
61 scoped_ptr<DistillerPage> distiller_page, | 69 scoped_ptr<DistillerPage> distiller_page, |
62 const ArticleAvailableCallback& article_cb) { | 70 const ArticleAvailableCallback& article_cb) { |
63 ArticleEntry entry; | 71 ArticleEntry entry; |
64 const bool is_already_added = store_->GetEntryByUrl(url, &entry); | 72 const bool is_already_added = store_->GetEntryByUrl(url, &entry); |
65 | 73 |
66 TaskTracker* task_tracker; | 74 TaskTracker* task_tracker; |
67 if (is_already_added) { | 75 if (is_already_added) { |
68 task_tracker = GetTaskTrackerForEntry(entry); | 76 task_tracker = GetTaskTrackerForEntry(entry); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 DCHECK(observer); | 233 DCHECK(observer); |
226 store_->AddObserver(observer); | 234 store_->AddObserver(observer); |
227 } | 235 } |
228 | 236 |
229 void DomDistillerService::RemoveObserver(DomDistillerObserver* observer) { | 237 void DomDistillerService::RemoveObserver(DomDistillerObserver* observer) { |
230 DCHECK(observer); | 238 DCHECK(observer); |
231 store_->RemoveObserver(observer); | 239 store_->RemoveObserver(observer); |
232 } | 240 } |
233 | 241 |
234 } // namespace dom_distiller | 242 } // namespace dom_distiller |
OLD | NEW |