| OLD | NEW |
| 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 "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 17 | 17 |
| 18 #if defined(TOOLKIT_VIEWS) | 18 #if defined(TOOLKIT_VIEWS) |
| 19 #include "views/view.h" | 19 #include "views/view.h" |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 namespace gfx { | |
| 23 class Canvas; | |
| 24 class Image; | |
| 25 } | |
| 26 | |
| 27 class BaseDownloadItemModel; | 22 class BaseDownloadItemModel; |
| 28 class DictionaryValue; | 23 class DictionaryValue; |
| 29 class DownloadItem; | 24 class DownloadItem; |
| 30 class DownloadManager; | 25 class DownloadManager; |
| 31 class GURL; | 26 class GURL; |
| 32 class Profile; | 27 class Profile; |
| 33 class ResourceDispatcherHost; | 28 class ResourceDispatcherHost; |
| 34 class SkBitmap; | 29 class SkBitmap; |
| 35 | 30 |
| 36 struct DownloadCreateInfo; | 31 struct DownloadCreateInfo; |
| 37 struct DownloadSaveInfo; | 32 struct DownloadSaveInfo; |
| 38 | 33 |
| 39 namespace net { | 34 namespace content { |
| 40 class URLRequestContextGetter; | 35 class ResourceContext; |
| 36 } |
| 37 |
| 38 namespace gfx { |
| 39 class Canvas; |
| 40 class Image; |
| 41 } | 41 } |
| 42 | 42 |
| 43 namespace download_util { | 43 namespace download_util { |
| 44 | 44 |
| 45 // Download temporary file creation -------------------------------------------- | 45 // Download temporary file creation -------------------------------------------- |
| 46 | 46 |
| 47 // Return the default download directory. | 47 // Return the default download directory. |
| 48 const FilePath& GetDefaultDownloadDirectory(); | 48 const FilePath& GetDefaultDownloadDirectory(); |
| 49 | 49 |
| 50 // Create a temporary file for a download in the user's default download | 50 // Create a temporary file for a download in the user's default download |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 int GetUniquePathNumber(const FilePath& path); | 231 int GetUniquePathNumber(const FilePath& path); |
| 232 | 232 |
| 233 // Download the URL. Must be called on the IO thread. | 233 // Download the URL. Must be called on the IO thread. |
| 234 void DownloadUrl(const GURL& url, | 234 void DownloadUrl(const GURL& url, |
| 235 const GURL& referrer, | 235 const GURL& referrer, |
| 236 const std::string& referrer_charset, | 236 const std::string& referrer_charset, |
| 237 const DownloadSaveInfo& save_info, | 237 const DownloadSaveInfo& save_info, |
| 238 ResourceDispatcherHost* rdh, | 238 ResourceDispatcherHost* rdh, |
| 239 int render_process_host_id, | 239 int render_process_host_id, |
| 240 int render_view_id, | 240 int render_view_id, |
| 241 net::URLRequestContextGetter* request_context_getter); | 241 const content::ResourceContext* context); |
| 242 | 242 |
| 243 // Tells the resource dispatcher host to cancel a download request. | 243 // Tells the resource dispatcher host to cancel a download request. |
| 244 // Must be called on the IO thread. | 244 // Must be called on the IO thread. |
| 245 void CancelDownloadRequest(ResourceDispatcherHost* rdh, | 245 void CancelDownloadRequest(ResourceDispatcherHost* rdh, |
| 246 int render_process_id, | 246 int render_process_id, |
| 247 int request_id); | 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); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 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_ |
| OLD | NEW |