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

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

Issue 1851803002: [NTP Popular Sites] Store country/version in prefs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 4 years, 8 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 | « chrome/browser/android/ntp/popular_sites.cc ('k') | chrome/browser/net/file_downloader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/file_downloader.h
diff --git a/chrome/browser/net/file_downloader.h b/chrome/browser/net/file_downloader.h
index d6383188464f3af04f6a66d801c3785c61c02636..4db2b6b7e2582492f42e9eb37f2813ca11855f92 100644
--- a/chrome/browser/net/file_downloader.h
+++ b/chrome/browser/net/file_downloader.h
@@ -25,7 +25,15 @@ class GURL;
// downloading anything.
class FileDownloader : public net::URLFetcherDelegate {
public:
- typedef base::Callback<void(bool /* success */)> DownloadFinishedCallback;
+ enum Result {
+ // The file was successfully downloaded.
+ DOWNLOADED,
+ // A local file at the given path already existed and was kept.
+ EXISTS,
+ // Downloading failed.
+ FAILED
+ };
+ using DownloadFinishedCallback = base::Callback<void(Result)>;
// Directly starts the download (if necessary) and runs |callback| when done.
// If the instance is destroyed before it is finished, |callback| is not run.
@@ -36,6 +44,8 @@ class FileDownloader : public net::URLFetcherDelegate {
const DownloadFinishedCallback& callback);
~FileDownloader() override;
+ static bool IsSuccess(Result result) { return result != FAILED; }
+
private:
// net::URLFetcherDelegate implementation.
void OnURLFetchComplete(const net::URLFetcher* source) override;
« no previous file with comments | « chrome/browser/android/ntp/popular_sites.cc ('k') | chrome/browser/net/file_downloader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698