Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: components/dom_distiller/core/dom_distiller_service.cc

Issue 442503002: Retrieve article original URL from entryID (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: string reference Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 task_tracker->AddSaveCallback(base::Bind( 101 task_tracker->AddSaveCallback(base::Bind(
102 &DomDistillerService::AddDistilledPageToList, base::Unretained(this))); 102 &DomDistillerService::AddDistilledPageToList, base::Unretained(this)));
103 task_tracker->StartDistiller(distiller_factory_.get(), 103 task_tracker->StartDistiller(distiller_factory_.get(),
104 distiller_page.Pass()); 104 distiller_page.Pass());
105 task_tracker->StartBlobFetcher(); 105 task_tracker->StartBlobFetcher();
106 } 106 }
107 107
108 return task_tracker->GetEntryId(); 108 return task_tracker->GetEntryId();
109 } 109 }
110 110
111 bool DomDistillerService::HasEntry(const std::string& entry_id) {
112 return store_->GetEntryById(entry_id, NULL);
113 }
114
115 std::string DomDistillerService::GetUrlForEntry(const std::string& entry_id) {
116 ArticleEntry entry;
117 if (store_->GetEntryById(entry_id, &entry)) {
118 return entry.pages().Get(0).url();
119 }
120 return "";
121 }
122
111 std::vector<ArticleEntry> DomDistillerService::GetEntries() const { 123 std::vector<ArticleEntry> DomDistillerService::GetEntries() const {
112 return store_->GetEntries(); 124 return store_->GetEntries();
113 } 125 }
114 126
115 scoped_ptr<ArticleEntry> DomDistillerService::RemoveEntry( 127 scoped_ptr<ArticleEntry> DomDistillerService::RemoveEntry(
116 const std::string& entry_id) { 128 const std::string& entry_id) {
117 scoped_ptr<ArticleEntry> entry(new ArticleEntry); 129 scoped_ptr<ArticleEntry> entry(new ArticleEntry);
118 entry->set_entry_id(entry_id); 130 entry->set_entry_id(entry_id);
119 TaskTracker* task_tracker = GetTaskTrackerForEntry(*entry); 131 TaskTracker* task_tracker = GetTaskTrackerForEntry(*entry);
120 if (task_tracker != NULL) { 132 if (task_tracker != NULL) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 void DomDistillerService::RemoveObserver(DomDistillerObserver* observer) { 252 void DomDistillerService::RemoveObserver(DomDistillerObserver* observer) {
241 DCHECK(observer); 253 DCHECK(observer);
242 store_->RemoveObserver(observer); 254 store_->RemoveObserver(observer);
243 } 255 }
244 256
245 DistilledPagePrefs* DomDistillerService::GetDistilledPagePrefs() { 257 DistilledPagePrefs* DomDistillerService::GetDistilledPagePrefs() {
246 return distilled_page_prefs_.get(); 258 return distilled_page_prefs_.get();
247 } 259 }
248 260
249 } // namespace dom_distiller 261 } // namespace dom_distiller
OLDNEW
« no previous file with comments | « components/dom_distiller/core/dom_distiller_service.h ('k') | components/dom_distiller/core/dom_distiller_service_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698