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

Unified Diff: content/public/browser/download_manager.h

Issue 9570005: Added callback to DownloadUrl() so we can find download failures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes per Randy's comments. Created 8 years, 9 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 | « content/browser/tab_contents/tab_contents.cc ('k') | content/test/mock_download_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/browser/download_manager.h
diff --git a/content/public/browser/download_manager.h b/content/public/browser/download_manager.h
index be490587764f21e13205f8184062ec259352f753..43c535cb39d37404b56b6f77be49b199a201cab5 100644
--- a/content/public/browser/download_manager.h
+++ b/content/public/browser/download_manager.h
@@ -32,6 +32,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/callback.h"
#include "base/file_path.h"
#include "base/gtest_prod_util.h"
#include "base/message_loop_helpers.h"
@@ -62,6 +63,9 @@ class WebContents;
class CONTENT_EXPORT DownloadManager
: public base::RefCountedThreadSafe<DownloadManager> {
public:
+ // NOTE: If there is an error, the DownloadId will be invalid.
+ typedef base::Callback<void(DownloadId, net::Error)> OnStartedCallback;
+
virtual ~DownloadManager() {}
static DownloadManager* Create(
@@ -177,13 +181,16 @@ class CONTENT_EXPORT DownloadManager
// saved, and whether the user should be prompted about the download.
// |web_contents| is the web page that the download is done in context of,
// and must be non-NULL.
+ // |callback| will be called when the download starts, or if an error
+ // occurs that prevents a download item from being created.
brettw 2012/03/09 22:53:42 This should mention that it can be a null callback
virtual void DownloadUrl(const GURL& url,
const GURL& referrer,
const std::string& referrer_encoding,
bool prefer_cache,
int64 post_id,
const DownloadSaveInfo& save_info,
- content::WebContents* web_contents) = 0;
+ content::WebContents* web_contents,
+ const OnStartedCallback& callback) = 0;
// Allow objects to observe the download creation process.
virtual void AddObserver(Observer* observer) = 0;
« no previous file with comments | « content/browser/tab_contents/tab_contents.cc ('k') | content/test/mock_download_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698