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

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

Issue 6995013: More progress towards removing content settings code from the content layer. We can't use Cookie... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments and sync 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
« no previous file with comments | « chrome/browser/download/download_util.cc ('k') | chrome/browser/download/save_file_manager.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) 2011 The Chromium Authors. All rights reserved. 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 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #define CHROME_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H__ 59 #define CHROME_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H__
60 #pragma once 60 #pragma once
61 61
62 #include <string> 62 #include <string>
63 63
64 #include "base/basictypes.h" 64 #include "base/basictypes.h"
65 #include "base/hash_tables.h" 65 #include "base/hash_tables.h"
66 #include "base/memory/ref_counted.h" 66 #include "base/memory/ref_counted.h"
67 #include "chrome/browser/download/save_types.h" 67 #include "chrome/browser/download/save_types.h"
68 68
69 namespace net {
70 class IOBuffer;
71 }
72 class FilePath; 69 class FilePath;
73 class GURL; 70 class GURL;
74 class SaveFile; 71 class SaveFile;
75 class SavePackage; 72 class SavePackage;
76 class ResourceDispatcherHost; 73 class ResourceDispatcherHost;
77 class Task; 74 class Task;
78 75
76 namespace content {
77 class ResourceContext;
78 }
79
79 namespace net { 80 namespace net {
80 class URLRequestContextGetter; 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 explicit SaveFileManager(ResourceDispatcherHost* rdh); 87 explicit SaveFileManager(ResourceDispatcherHost* rdh);
87 88
88 // Lifetime management. 89 // Lifetime management.
89 void Shutdown(); 90 void Shutdown();
90 91
91 // Called on the IO thread 92 // Called on the IO thread
92 int GetNextId(); 93 int GetNextId();
93 94
94 // Save the specified URL. Called on the UI thread and forwarded to the 95 // Save the specified URL. Called on the UI thread and forwarded to the
95 // ResourceDispatcherHost on the IO thread. 96 // ResourceDispatcherHost on the IO thread.
96 void SaveURL(const GURL& url, 97 void SaveURL(const GURL& url,
97 const GURL& referrer, 98 const GURL& referrer,
98 int render_process_host_id, 99 int render_process_host_id,
99 int render_view_id, 100 int render_view_id,
100 SaveFileCreateInfo::SaveFileSource save_source, 101 SaveFileCreateInfo::SaveFileSource save_source,
101 const FilePath& file_full_path, 102 const FilePath& file_full_path,
102 net::URLRequestContextGetter* request_context_getter, 103 const content::ResourceContext& context,
103 SavePackage* save_package); 104 SavePackage* save_package);
104 105
105 // Notifications sent from the IO thread and run on the file thread: 106 // Notifications sent from the IO thread and run on the file thread:
106 void StartSave(SaveFileCreateInfo* info); 107 void StartSave(SaveFileCreateInfo* info);
107 void UpdateSaveProgress(int save_id, net::IOBuffer* data, int size); 108 void UpdateSaveProgress(int save_id, net::IOBuffer* data, int size);
108 void SaveFinished(int save_id, 109 void SaveFinished(int save_id,
109 const GURL& save_url, 110 const GURL& save_url,
110 int render_process_id, 111 int render_process_id,
111 bool is_success); 112 bool is_success);
112 113
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // Deletes a specified file on the file thread. 207 // Deletes a specified file on the file thread.
207 void OnDeleteDirectoryOrFile(const FilePath& full_path, bool is_dir); 208 void OnDeleteDirectoryOrFile(const FilePath& full_path, bool is_dir);
208 209
209 // Notifications sent from the UI thread and run on the IO thread 210 // Notifications sent from the UI thread and run on the IO thread
210 211
211 // Initiates a request for URL to be saved. 212 // Initiates a request for URL to be saved.
212 void OnSaveURL(const GURL& url, 213 void OnSaveURL(const GURL& url,
213 const GURL& referrer, 214 const GURL& referrer,
214 int render_process_host_id, 215 int render_process_host_id,
215 int render_view_id, 216 int render_view_id,
216 net::URLRequestContextGetter* request_context_getter); 217 const content::ResourceContext* context);
217 // Handler for a notification sent to the IO thread for generating save id. 218 // Handler for a notification sent to the IO thread for generating save id.
218 void OnRequireSaveJobFromOtherSource(SaveFileCreateInfo* info); 219 void OnRequireSaveJobFromOtherSource(SaveFileCreateInfo* info);
219 // Call ResourceDispatcherHost's CancelRequest method to execute cancel 220 // Call ResourceDispatcherHost's CancelRequest method to execute cancel
220 // action in the IO thread. 221 // action in the IO thread.
221 void ExecuteCancelSaveRequest(int render_process_id, int request_id); 222 void ExecuteCancelSaveRequest(int render_process_id, int request_id);
222 223
223 // Unique ID for the next SaveFile object. 224 // Unique ID for the next SaveFile object.
224 int next_id_; 225 int next_id_;
225 226
226 // A map of all saving jobs by using save id. 227 // A map of all saving jobs by using save id.
(...skipping 18 matching lines...) Expand all
245 // hashmap since it is possible to save same URL in different tab at 246 // hashmap since it is possible to save same URL in different tab at
246 // same time. 247 // same time.
247 typedef base::hash_map<std::string, SavePackage*> StartingRequestsMap; 248 typedef base::hash_map<std::string, SavePackage*> StartingRequestsMap;
248 typedef base::hash_map<int, StartingRequestsMap> TabToStartingRequestsMap; 249 typedef base::hash_map<int, StartingRequestsMap> TabToStartingRequestsMap;
249 TabToStartingRequestsMap tab_starting_requests_; 250 TabToStartingRequestsMap tab_starting_requests_;
250 251
251 DISALLOW_COPY_AND_ASSIGN(SaveFileManager); 252 DISALLOW_COPY_AND_ASSIGN(SaveFileManager);
252 }; 253 };
253 254
254 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H__ 255 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H__
OLDNEW
« no previous file with comments | « chrome/browser/download/download_util.cc ('k') | chrome/browser/download/save_file_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698