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

Side by Side Diff: content/browser/download/save_types.h

Issue 1484093002: Allowing multiple SaveItems to have same URLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nested-frames-more-involved-fix
Patch Set: Rebasing... Created 5 years 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
« no previous file with comments | « content/browser/download/save_package.cc ('k') | content/browser/download/save_types.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_BROWSER_DOWNLOAD_SAVE_TYPES_H_ 5 #ifndef CONTENT_BROWSER_DOWNLOAD_SAVE_TYPES_H_
6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_TYPES_H_ 6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_TYPES_H_
7 7
8 #include <map>
8 #include <string> 9 #include <string>
9 #include <utility> 10 #include <utility>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/basictypes.h" 13 #include "base/basictypes.h"
13 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
14 #include "url/gurl.h" 15 #include "url/gurl.h"
15 16
16 namespace content { 17 namespace content {
17 typedef std::vector<std::pair<int, base::FilePath> > FinalNameList; 18
18 typedef std::vector<int> SaveIDList; 19 // Map from save_item_id into final file path.
20 typedef std::map<int, base::FilePath> FinalNamesMap;
19 21
20 // This structure is used to handle and deliver some info 22 // This structure is used to handle and deliver some info
21 // when processing each save item job. 23 // when processing each save item job.
22 struct SaveFileCreateInfo { 24 struct SaveFileCreateInfo {
23 enum SaveFileSource { 25 enum SaveFileSource {
24 // This type indicates the source is not set. 26 // This type indicates the source is not set.
25 SAVE_FILE_FROM_UNKNOWN = -1, 27 SAVE_FILE_FROM_UNKNOWN = -1,
26 // This type indicates the save item needs to be retrieved from the network. 28 // This type indicates the save item needs to be retrieved from the network.
27 SAVE_FILE_FROM_NET = 0, 29 SAVE_FILE_FROM_NET = 0,
28 // This type indicates the save item needs to be retrieved from serializing 30 // This type indicates the save item needs to be retrieved from serializing
29 // DOM. 31 // DOM.
30 SAVE_FILE_FROM_DOM, 32 SAVE_FILE_FROM_DOM,
31 // This type indicates the save item needs to be retrieved from local file 33 // This type indicates the save item needs to be retrieved from local file
32 // system. 34 // system.
33 SAVE_FILE_FROM_FILE 35 SAVE_FILE_FROM_FILE
34 }; 36 };
35 37
38 // Constructor for SAVE_FILE_FROM_DOM and/or SAVE_FILE_FROM_FILE.
36 SaveFileCreateInfo(const base::FilePath& path, 39 SaveFileCreateInfo(const base::FilePath& path,
37 const GURL& url, 40 const GURL& url,
38 SaveFileSource save_source, 41 int save_item_id,
39 int32 save_id); 42 int save_package_id,
43 int render_process_id,
44 int render_frame_routing_id,
45 SaveFileSource save_source);
40 46
41 SaveFileCreateInfo(); 47 // Constructor for SAVE_FILE_FROM_NET case.
48 SaveFileCreateInfo(const GURL& url,
49 const GURL& final_url,
50 int save_item_id,
51 int save_package_id,
52 int render_process_id,
53 int render_frame_routing_id,
54 int request_id,
55 const std::string& content_disposition,
56 int64 total_bytes);
42 57
43 ~SaveFileCreateInfo(); 58 ~SaveFileCreateInfo();
44 59
45 // SaveItem fields. 60 // SaveItem fields.
46 // The local file path of saved file. 61 // The local file path of saved file.
47 base::FilePath path; 62 base::FilePath path;
48 // Original URL of the saved resource. 63 // Original URL of the saved resource.
49 GURL url; 64 GURL url;
50 // Final URL of the saved resource since some URL might be redirected. 65 // Final URL of the saved resource since some URL might be redirected.
51 GURL final_url; 66 GURL final_url;
52 // The unique identifier for saving job, assigned at creation by 67 // The unique identifier of SaveItem object associated with this job.
53 // the SaveFileManager for its internal record keeping. 68 int save_item_id;
54 int save_id;
55 // ID of SavePackage object. 69 // ID of SavePackage object.
56 int save_package_id; 70 int save_package_id;
57 // IDs for looking up the contents we are associated with. 71 // IDs for looking up the contents we are associated with.
58 int render_process_id; 72 int render_process_id;
59 int render_frame_routing_id; 73 int render_frame_routing_id;
60 // Handle for informing the ResourceDispatcherHost of a UI based cancel. 74 // Handle for informing the ResourceDispatcherHost of a UI based cancel.
61 int request_id; 75 int request_id;
62 // Disposition info from HTTP response. 76 // Disposition info from HTTP response.
63 std::string content_disposition; 77 std::string content_disposition;
64 // Total bytes of saved file. 78 // Total bytes of saved file.
65 int64 total_bytes; 79 int64 total_bytes;
66 // Source type of saved file. 80 // Source type of saved file.
67 SaveFileSource save_source; 81 SaveFileSource save_source;
68 }; 82 };
69 83
70 } // namespace content 84 } // namespace content
71 85
72 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_TYPES_H_ 86 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_TYPES_H_
OLDNEW
« no previous file with comments | « content/browser/download/save_package.cc ('k') | content/browser/download/save_types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698