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

Side by Side Diff: chrome/browser/download/download_create_info.h

Issue 6969009: Reduced the lifetime of DownloadCreateInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed spurious DCHECK. Created 9 years, 7 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
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // Download creation struct used for initializing the download information.
Paweł Hajdan Jr. 2011/05/20 09:04:42 nit: I think this comment is very vague, and the c
ahendrickson 2011/05/20 18:31:25 Done.
6
7 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CREATE_INFO_H_
8 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CREATE_INFO_H_
9 #pragma once
10
11 #include <string>
12 #include <vector>
13
14 #include "base/basictypes.h"
15 #include "base/file_path.h"
16 #include "base/time.h"
17 #include "chrome/browser/download/download_file.h"
18 #include "chrome/browser/download/download_process_handle.h"
19 #include "googleurl/src/gurl.h"
20
21 // Used for informing the download database of a new download, where we don't
22 // want to pass DownloadItems between threads.
23 struct DownloadCreateInfo {
24 DownloadCreateInfo(const FilePath& path,
25 const GURL& url,
26 const base::Time& start_time,
27 int64 received_bytes,
28 int64 total_bytes,
29 int32 state,
30 int32 download_id,
31 bool has_user_gesture);
32 DownloadCreateInfo();
33 ~DownloadCreateInfo();
34
35 // Returns true if the download is dangerous.
36 bool IsDangerous() const;
37
38 std::string DebugString() const;
39
40 // The URL from which we are downloading. This is the final URL after any
41 // redirection by the server for |url_chain|.
42 const GURL& url() const;
43
44 // DownloadItem fields
45 // The path where we want to save the download file.
46 FilePath path;
47
48 // The chain of redirects that leading up to and including the final URL.
49 std::vector<GURL> url_chain;
50
51 // The URL that referred us.
52 GURL referrer_url;
53
54 // The default path for the download (may be overridden).
55 FilePath suggested_path;
56
57 // A number that should be added to the suggested path to make it unique.
58 // 0 means no number should be appended. Not actually stored in the db.
59 int path_uniquifier;
60
61 // The time when the download started.
62 base::Time start_time;
63
64 // The number of bytes that have been received.
65 int64 received_bytes;
66
67 // The total download size.
68 int64 total_bytes;
69
70 // The current state of the download.
71 int32 state;
72
73 // The (per-session) ID of the download.
74 int32 download_id;
75
76 // True if the download was initiated by user action.
77 bool has_user_gesture;
78
79 // The handle to the process information. Used for operations outside the
80 // download system.
81 DownloadProcessHandle process_handle;
82
83 // The handle of the download in the history database.
84 int64 db_handle;
85
86 // The content-disposition string from the response header.
87 std::string content_disposition;
88
89 // The mime type string from the response header (may be overridden).
90 std::string mime_type;
91
92 // The value of the content type header sent with the downloaded item. It
93 // may be different from |mime_type|, which may be set based on heuristics
94 // which may look at the file extension and first few bytes of the file.
95 std::string original_mime_type;
96
97 // True if we should display the 'save as...' UI and prompt the user
98 // for the download location.
99 // False if the UI should be supressed and the download performed to the
100 // default location.
101 bool prompt_user_for_save_location;
102
103 // Whether this download file is potentially dangerous (ex: exe, dll, ...).
104 bool is_dangerous_file;
105
106 // If safebrowsing believes this URL leads to malware.
107 bool is_dangerous_url;
108
109 // The original name for a dangerous download.
110 FilePath original_name;
111
112 // Whether this download is for extension install or not.
113 bool is_extension_install;
114
115 // The charset of the referring page where the download request comes from.
116 // It's used to construct a suggested filename.
117 std::string referrer_charset;
118
119 // The download file save info.
120 DownloadSaveInfo save_info;
121 };
122
123 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CREATE_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698