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

Unified Diff: chrome/browser/net/file_downloader.cc

Issue 1308723005: Popular sites on the NTP: re-download popular suggestions once per Chrome run (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@knn_ordering
Patch Set: rebase Created 5 years, 3 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
Index: chrome/browser/net/file_downloader.cc
diff --git a/chrome/browser/net/file_downloader.cc b/chrome/browser/net/file_downloader.cc
index d97fa272efa304f2c4378e81c300e1abb40e0c49..eeab309e019d4ea407af8173e2cc7738b4b117b4 100644
--- a/chrome/browser/net/file_downloader.cc
+++ b/chrome/browser/net/file_downloader.cc
@@ -21,6 +21,7 @@ const int kNumRetries = 1;
FileDownloader::FileDownloader(const GURL& url,
const base::FilePath& path,
+ bool overwrite,
net::URLRequestContextGetter* request_context,
const DownloadFinishedCallback& callback)
: callback_(callback),
@@ -34,13 +35,17 @@ FileDownloader::FileDownloader(const GURL& url,
path,
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
- base::PostTaskAndReplyWithResult(
- BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
- base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN).get(),
- FROM_HERE,
- base::Bind(&base::PathExists, path),
- base::Bind(&FileDownloader::OnFileExistsCheckDone,
- weak_ptr_factory_.GetWeakPtr()));
+ if (overwrite) {
+ fetcher_->Start();
+ } else {
+ base::PostTaskAndReplyWithResult(
+ BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
+ base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN).get(),
+ FROM_HERE,
+ base::Bind(&base::PathExists, path),
+ base::Bind(&FileDownloader::OnFileExistsCheckDone,
+ weak_ptr_factory_.GetWeakPtr()));
+ }
}
FileDownloader::~FileDownloader() {}

Powered by Google App Engine
This is Rietveld 408576698