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

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

Issue 6932046: Added DownloadProcessHandle class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup per Pawel's comments. 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
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 // Download utilities. 5 // Download utilities.
6 6
7 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ 7 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_
8 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ 8 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_
9 #pragma once 9 #pragma once
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/file_path.h" 14 #include "base/file_path.h"
15 #include "base/string16.h" 15 #include "base/string16.h"
16 #include "chrome/browser/download/download_process_handle.h"
16 #include "ui/gfx/native_widget_types.h" 17 #include "ui/gfx/native_widget_types.h"
17 18
18 #if defined(TOOLKIT_VIEWS) 19 #if defined(TOOLKIT_VIEWS)
19 #include "views/view.h" 20 #include "views/view.h"
20 #endif 21 #endif
21 22
22 namespace gfx { 23 namespace gfx {
23 class Canvas; 24 class Canvas;
24 class Image; 25 class Image;
25 } 26 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 const std::string& referrer_charset, 237 const std::string& referrer_charset,
237 const DownloadSaveInfo& save_info, 238 const DownloadSaveInfo& save_info,
238 ResourceDispatcherHost* rdh, 239 ResourceDispatcherHost* rdh,
239 int render_process_host_id, 240 int render_process_host_id,
240 int render_view_id, 241 int render_view_id,
241 net::URLRequestContextGetter* request_context_getter); 242 net::URLRequestContextGetter* request_context_getter);
242 243
243 // Tells the resource dispatcher host to cancel a download request. 244 // Tells the resource dispatcher host to cancel a download request.
244 // Must be called on the IO thread. 245 // Must be called on the IO thread.
245 void CancelDownloadRequest(ResourceDispatcherHost* rdh, 246 void CancelDownloadRequest(ResourceDispatcherHost* rdh,
246 int render_process_id, 247 DownloadProcessHandle process_handle);
Paweł Hajdan Jr. 2011/05/09 19:47:31 nit: Why not a pointer?
ahendrickson 2011/05/10 18:04:43 Because it is ultimately passed to another thread,
247 int request_id);
248 248
249 // Sends a notification on downloads being initiated 249 // Sends a notification on downloads being initiated
250 // Must be called on the UI thread. 250 // Must be called on the UI thread.
251 void NotifyDownloadInitiated(int render_process_id, int render_view_id); 251 void NotifyDownloadInitiated(int render_process_id, int render_view_id);
252 252
253 // Same as GetUniquePathNumber, except that it also checks the existence 253 // Same as GetUniquePathNumber, except that it also checks the existence
254 // of its .crdownload intermediate path. 254 // of its .crdownload intermediate path.
255 // If |path| does not exist, 0 is returned. If it fails to find such 255 // If |path| does not exist, 0 is returned. If it fails to find such
256 // a number, -1 is returned. 256 // a number, -1 is returned.
257 int GetUniquePathNumberWithCrDownload(const FilePath& path); 257 int GetUniquePathNumberWithCrDownload(const FilePath& path);
258 258
259 // Erases all downloaded files with the specified path and name prefix. 259 // Erases all downloaded files with the specified path and name prefix.
260 // Used by download UI tests to clean up the download directory. 260 // Used by download UI tests to clean up the download directory.
261 void EraseUniqueDownloadFiles(const FilePath& path_prefix); 261 void EraseUniqueDownloadFiles(const FilePath& path_prefix);
262 262
263 // Returns a .crdownload intermediate path for the |suggested_path|. 263 // Returns a .crdownload intermediate path for the |suggested_path|.
264 FilePath GetCrDownloadPath(const FilePath& suggested_path); 264 FilePath GetCrDownloadPath(const FilePath& suggested_path);
265 265
266 // Returns true if this download should show the "dangerous file" warning. 266 // Returns true if this download should show the "dangerous file" warning.
267 // Various factors are considered, such as the type of the file, whether a 267 // Various factors are considered, such as the type of the file, whether a
268 // user action initiated the download, and whether the user has explictly 268 // user action initiated the download, and whether the user has explictly
269 // marked the file type as "auto open". 269 // marked the file type as "auto open".
270 bool IsDangerous(DownloadCreateInfo* info, Profile* profile, bool auto_open); 270 bool IsDangerous(DownloadCreateInfo* info, Profile* profile, bool auto_open);
271 271
272 } // namespace download_util 272 } // namespace download_util
273 273
274 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ 274 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698