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 "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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 return distiller_page_factory_->CreateDistillerPage(render_view_size).Pass(); | 60 return distiller_page_factory_->CreateDistillerPage(render_view_size).Pass(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 scoped_ptr<DistillerPage> | 63 scoped_ptr<DistillerPage> |
| 64 DomDistillerService::CreateDefaultDistillerPageWithHandle( | 64 DomDistillerService::CreateDefaultDistillerPageWithHandle( |
| 65 scoped_ptr<SourcePageHandle> handle) { | 65 scoped_ptr<SourcePageHandle> handle) { |
| 66 return distiller_page_factory_->CreateDistillerPageWithHandle(handle.Pass()) | 66 return distiller_page_factory_->CreateDistillerPageWithHandle(handle.Pass()) |
| 67 .Pass(); | 67 .Pass(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool DomDistillerService::HasEntry(const std::string entry_id) { | |
| 71 return store_->GetEntryById(entry_id, NULL); | |
| 72 } | |
| 73 | |
| 74 // Returns the source URL given an entry ID. If the entry ID article has | |
|
nyquist
2014/08/13 20:09:10
Move this comment to the interface and add a comme
sunangel
2014/08/13 21:49:32
Done.
| |
| 75 // multiple pages, this will return the URL of the first page. Returns an empty | |
| 76 // string if there is no entry associated with the given entry ID. | |
| 77 std::string DomDistillerService::GetUrlForEntry(const std::string entry_id) { | |
| 78 ArticleEntry entry; | |
| 79 if (store_->GetEntryById(entry_id, &entry)) { | |
| 80 return entry.pages().Get(0).url(); | |
| 81 } | |
| 82 return ""; | |
| 83 } | |
| 84 | |
| 70 const std::string DomDistillerService::AddToList( | 85 const std::string DomDistillerService::AddToList( |
| 71 const GURL& url, | 86 const GURL& url, |
| 72 scoped_ptr<DistillerPage> distiller_page, | 87 scoped_ptr<DistillerPage> distiller_page, |
| 73 const ArticleAvailableCallback& article_cb) { | 88 const ArticleAvailableCallback& article_cb) { |
| 74 ArticleEntry entry; | 89 ArticleEntry entry; |
| 75 const bool is_already_added = store_->GetEntryByUrl(url, &entry); | 90 const bool is_already_added = store_->GetEntryByUrl(url, &entry); |
| 76 | 91 |
| 77 TaskTracker* task_tracker; | 92 TaskTracker* task_tracker; |
| 78 if (is_already_added) { | 93 if (is_already_added) { |
| 79 task_tracker = GetTaskTrackerForEntry(entry); | 94 task_tracker = GetTaskTrackerForEntry(entry); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 void DomDistillerService::RemoveObserver(DomDistillerObserver* observer) { | 255 void DomDistillerService::RemoveObserver(DomDistillerObserver* observer) { |
| 241 DCHECK(observer); | 256 DCHECK(observer); |
| 242 store_->RemoveObserver(observer); | 257 store_->RemoveObserver(observer); |
| 243 } | 258 } |
| 244 | 259 |
| 245 DistilledPagePrefs* DomDistillerService::GetDistilledPagePrefs() { | 260 DistilledPagePrefs* DomDistillerService::GetDistilledPagePrefs() { |
| 246 return distilled_page_prefs_.get(); | 261 return distilled_page_prefs_.get(); |
| 247 } | 262 } |
| 248 | 263 |
| 249 } // namespace dom_distiller | 264 } // namespace dom_distiller |
| OLD | NEW |