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

Unified Diff: components/ntp_snippets/ntp_snippets_fetcher.cc

Issue 1756443002: [NTP Snippets] Fetcher: remove |overwrite| param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@snippets_expire
Patch Set: fix test Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/ntp_snippets/ntp_snippets_fetcher.h ('k') | components/ntp_snippets/ntp_snippets_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/ntp_snippets_fetcher.cc
diff --git a/components/ntp_snippets/ntp_snippets_fetcher.cc b/components/ntp_snippets/ntp_snippets_fetcher.cc
index 7c74fcfe7e5f2c65b44061d4af0eab9e98be78e6..289b8f3be81e65656f06ada6a74125a56781ea16 100644
--- a/components/ntp_snippets/ntp_snippets_fetcher.cc
+++ b/components/ntp_snippets/ntp_snippets_fetcher.cc
@@ -66,27 +66,7 @@ NTPSnippetsFetcher::AddCallback(const SnippetsAvailableCallback& callback) {
return callback_list_.Add(callback);
}
-void NTPSnippetsFetcher::FetchSnippets(bool overwrite) {
- if (overwrite) {
- StartFetch();
- } else {
- base::PostTaskAndReplyWithResult(
- file_task_runner_.get(), FROM_HERE,
- base::Bind(&base::PathExists, download_path_),
- base::Bind(&NTPSnippetsFetcher::OnFileExistsCheckDone,
- weak_ptr_factory_.GetWeakPtr()));
- }
-}
-
-void NTPSnippetsFetcher::OnFileExistsCheckDone(bool exists) {
- if (exists) {
- NotifyObservers();
- } else {
- StartFetch();
- }
-}
-
-void NTPSnippetsFetcher::StartFetch() {
+void NTPSnippetsFetcher::FetchSnippets() {
if (signin_manager_->IsAuthenticated()) {
StartTokenRequest();
} else {
@@ -105,6 +85,16 @@ void NTPSnippetsFetcher::StartTokenRequest() {
signin_manager_->GetAuthenticatedAccountId(), scopes, this);
}
+void NTPSnippetsFetcher::OnFileMoveDone(bool success) {
+ if (!success) {
+ DLOG(WARNING) << "Could not move file to "
+ << download_path_.LossyDisplayName();
+ return;
+ }
+
+ NotifyObservers();
+}
+
void NTPSnippetsFetcher::NotifyObservers() {
callback_list_.Notify(download_path_);
}
@@ -178,14 +168,4 @@ void NTPSnippetsFetcher::OnURLFetchComplete(const URLFetcher* source) {
weak_ptr_factory_.GetWeakPtr()));
}
-void NTPSnippetsFetcher::OnFileMoveDone(bool success) {
- if (!success) {
- DLOG(WARNING) << "Could not move file to "
- << download_path_.LossyDisplayName();
- return;
- }
-
- NotifyObservers();
-}
-
} // namespace ntp_snippets
« no previous file with comments | « components/ntp_snippets/ntp_snippets_fetcher.h ('k') | components/ntp_snippets/ntp_snippets_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698