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

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

Issue 10387090: Pass the referrer policy with the referrer for the save package code path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 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
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 // Objects that handle file operations for saving files, on the file thread. 5 // Objects that handle file operations for saving files, on the file thread.
6 // 6 //
7 // The SaveFileManager owns a set of SaveFile objects, each of which connects 7 // The SaveFileManager owns a set of SaveFile objects, each of which connects
8 // with a SaveItem object which belongs to one SavePackage and runs on the file 8 // with a SaveItem object which belongs to one SavePackage and runs on the file
9 // thread for saving data in order to avoid disk activity on either network IO 9 // thread for saving data in order to avoid disk activity on either network IO
10 // thread or the UI thread. It coordinates the notifications from the network 10 // thread or the UI thread. It coordinates the notifications from the network
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "base/memory/ref_counted.h" 66 #include "base/memory/ref_counted.h"
67 #include "content/browser/download/save_types.h" 67 #include "content/browser/download/save_types.h"
68 #include "content/common/content_export.h" 68 #include "content/common/content_export.h"
69 69
70 class FilePath; 70 class FilePath;
71 class GURL; 71 class GURL;
72 class SaveFile; 72 class SaveFile;
73 class SavePackage; 73 class SavePackage;
74 74
75 namespace content { 75 namespace content {
76 struct Referrer;
76 class ResourceContext; 77 class ResourceContext;
77 } 78 }
78 79
79 namespace net { 80 namespace net {
80 class IOBuffer; 81 class IOBuffer;
81 } 82 }
82 83
83 class SaveFileManager 84 class SaveFileManager
84 : public base::RefCountedThreadSafe<SaveFileManager> { 85 : public base::RefCountedThreadSafe<SaveFileManager> {
85 public: 86 public:
86 SaveFileManager(); 87 SaveFileManager();
87 88
88 // Lifetime management. 89 // Lifetime management.
89 CONTENT_EXPORT void Shutdown(); 90 CONTENT_EXPORT void Shutdown();
90 91
91 // Called on the IO thread. This generates unique IDs for 92 // Called on the IO thread. This generates unique IDs for
92 // SaveFileResourceHandler objects (there's one per file in a SavePackage). 93 // SaveFileResourceHandler objects (there's one per file in a SavePackage).
93 // Note that this is different from the SavePackage's id. 94 // Note that this is different from the SavePackage's id.
94 int GetNextId(); 95 int GetNextId();
95 96
96 // Save the specified URL. Called on the UI thread and forwarded to the 97 // Save the specified URL. Called on the UI thread and forwarded to the
97 // ResourceDispatcherHostImpl on the IO thread. 98 // ResourceDispatcherHostImpl on the IO thread.
98 void SaveURL(const GURL& url, 99 void SaveURL(const GURL& url,
99 const GURL& referrer, 100 const content::Referrer& referrer,
100 int render_process_host_id, 101 int render_process_host_id,
101 int render_view_id, 102 int render_view_id,
102 SaveFileCreateInfo::SaveFileSource save_source, 103 SaveFileCreateInfo::SaveFileSource save_source,
103 const FilePath& file_full_path, 104 const FilePath& file_full_path,
104 content::ResourceContext* context, 105 content::ResourceContext* context,
105 SavePackage* save_package); 106 SavePackage* save_package);
106 107
107 // Notifications sent from the IO thread and run on the file thread: 108 // Notifications sent from the IO thread and run on the file thread:
108 void StartSave(SaveFileCreateInfo* info); 109 void StartSave(SaveFileCreateInfo* info);
109 void UpdateSaveProgress(int save_id, net::IOBuffer* data, int size); 110 void UpdateSaveProgress(int save_id, net::IOBuffer* data, int size);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 200
200 // Notifications sent from the UI thread and run on the file thread. 201 // Notifications sent from the UI thread and run on the file thread.
201 202
202 // Deletes a specified file on the file thread. 203 // Deletes a specified file on the file thread.
203 void OnDeleteDirectoryOrFile(const FilePath& full_path, bool is_dir); 204 void OnDeleteDirectoryOrFile(const FilePath& full_path, bool is_dir);
204 205
205 // Notifications sent from the UI thread and run on the IO thread 206 // Notifications sent from the UI thread and run on the IO thread
206 207
207 // Initiates a request for URL to be saved. 208 // Initiates a request for URL to be saved.
208 void OnSaveURL(const GURL& url, 209 void OnSaveURL(const GURL& url,
209 const GURL& referrer, 210 const content::Referrer& referrer,
210 int render_process_host_id, 211 int render_process_host_id,
211 int render_view_id, 212 int render_view_id,
212 content::ResourceContext* context); 213 content::ResourceContext* context);
213 // Handler for a notification sent to the IO thread for generating save id. 214 // Handler for a notification sent to the IO thread for generating save id.
214 void OnRequireSaveJobFromOtherSource(SaveFileCreateInfo* info); 215 void OnRequireSaveJobFromOtherSource(SaveFileCreateInfo* info);
215 // Call ResourceDispatcherHostImpl's CancelRequest method to execute cancel 216 // Call ResourceDispatcherHostImpl's CancelRequest method to execute cancel
216 // action in the IO thread. 217 // action in the IO thread.
217 void ExecuteCancelSaveRequest(int render_process_id, int request_id); 218 void ExecuteCancelSaveRequest(int render_process_id, int request_id);
218 219
219 // Unique ID for the next SaveFile object. 220 // Unique ID for the next SaveFile object.
(...skipping 20 matching lines...) Expand all
240 // same time. 241 // same time.
241 typedef base::hash_map<std::string, SavePackage*> StartingRequestsMap; 242 typedef base::hash_map<std::string, SavePackage*> StartingRequestsMap;
242 typedef base::hash_map<int, StartingRequestsMap> 243 typedef base::hash_map<int, StartingRequestsMap>
243 ContentsToStartingRequestsMap; 244 ContentsToStartingRequestsMap;
244 ContentsToStartingRequestsMap contents_starting_requests_; 245 ContentsToStartingRequestsMap contents_starting_requests_;
245 246
246 DISALLOW_COPY_AND_ASSIGN(SaveFileManager); 247 DISALLOW_COPY_AND_ASSIGN(SaveFileManager);
247 }; 248 };
248 249
249 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H_ 250 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/download/save_file_manager.cc » ('j') | content/renderer/render_view_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698