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

Side by Side Diff: content/public/browser/download_url_parameters.h

Issue 11068027: OnDownloadStarted takes DownloadItem* instead of DownloadId (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r160830 Created 8 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_
6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ 6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "content/public/browser/download_id.h"
14 #include "content/public/browser/download_save_info.h" 13 #include "content/public/browser/download_save_info.h"
15 #include "content/public/common/referrer.h" 14 #include "content/public/common/referrer.h"
16 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
17 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
18 17
19 namespace content { 18 namespace content {
20 19
20 class DownloadItem;
21 class ResourceContext; 21 class ResourceContext;
22 class ResourceDispatcherHost; 22 class ResourceDispatcherHost;
23 class WebContents; 23 class WebContents;
24 24
25 // Pass an instance of DownloadUrlParameters to DownloadManager::DownloadUrl() 25 // Pass an instance of DownloadUrlParameters to DownloadManager::DownloadUrl()
26 // to download the content at |url|. All parameters with setters are optional. 26 // to download the content at |url|. All parameters with setters are optional.
27 // |referrer| and |referrer_encoding| are the referrer for the download. If 27 // |referrer| and |referrer_encoding| are the referrer for the download. If
28 // |prefer_cache| is true, then if the response to |url| is in the HTTP cache it 28 // |prefer_cache| is true, then if the response to |url| is in the HTTP cache it
29 // will be used without revalidation. If |post_id| is non-negative, then it 29 // will be used without revalidation. If |post_id| is non-negative, then it
30 // identifies the post transaction used to originally retrieve the |url| 30 // identifies the post transaction used to originally retrieve the |url|
31 // resource - it also requires |prefer_cache| to be |true| since re-post'ing is 31 // resource - it also requires |prefer_cache| to be |true| since re-post'ing is
32 // not done. |save_info| specifies where the downloaded file should be saved, 32 // not done. |save_info| specifies where the downloaded file should be saved,
33 // and whether the user should be prompted about the download. If not null, 33 // and whether the user should be prompted about the download. If not null,
34 // |callback| will be called when the download starts, or if an error occurs 34 // |callback| will be called when the download starts, or if an error occurs
35 // that prevents a download item from being created. We send a pointer to 35 // that prevents a download item from being created. We send a pointer to
36 // content::ResourceContext instead of the usual reference so that a copy of the 36 // content::ResourceContext instead of the usual reference so that a copy of the
37 // object isn't made. 37 // object isn't made.
38 38
39 class CONTENT_EXPORT DownloadUrlParameters { 39 class CONTENT_EXPORT DownloadUrlParameters {
40 public: 40 public:
41 // The DownloadId will be invalid if-and-only-if there is an error. 41 // If there is an error, then |item| will be NULL.
42 typedef base::Callback<void(DownloadId, net::Error)> OnStartedCallback; 42 typedef base::Callback<void(DownloadItem*, net::Error)> OnStartedCallback;
43 43
44 typedef std::pair<std::string, std::string> RequestHeadersNameValuePair; 44 typedef std::pair<std::string, std::string> RequestHeadersNameValuePair;
45 typedef std::vector<RequestHeadersNameValuePair> RequestHeadersType; 45 typedef std::vector<RequestHeadersNameValuePair> RequestHeadersType;
46 46
47 static DownloadUrlParameters* FromWebContents( 47 static DownloadUrlParameters* FromWebContents(
48 WebContents* web_contents, 48 WebContents* web_contents,
49 const GURL& url, 49 const GURL& url,
50 const DownloadSaveInfo& save_info); 50 const DownloadSaveInfo& save_info);
51 51
52 DownloadUrlParameters( 52 DownloadUrlParameters(
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 ResourceDispatcherHost* resource_dispatcher_host_; 128 ResourceDispatcherHost* resource_dispatcher_host_;
129 DownloadSaveInfo save_info_; 129 DownloadSaveInfo save_info_;
130 GURL url_; 130 GURL url_;
131 131
132 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); 132 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters);
133 }; 133 };
134 134
135 } // namespace content 135 } // namespace content
136 136
137 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ 137 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_
OLDNEW
« no previous file with comments | « content/public/browser/download_manager.h ('k') | content/public/browser/resource_dispatcher_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698