OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // The DownloadManager object manages the process of downloading, including | 5 // The DownloadManager object manages the process of downloading, including |
6 // updates to the history system and providing the information for displaying | 6 // updates to the history system and providing the information for displaying |
7 // the downloads view in the Destinations tab. There is one DownloadManager per | 7 // the downloads view in the Destinations tab. There is one DownloadManager per |
8 // active profile in Chrome. | 8 // active profile in Chrome. |
9 // | 9 // |
10 // Each download is represented by a DownloadItem, and all DownloadItems | 10 // Each download is represented by a DownloadItem, and all DownloadItems |
(...skipping 25 matching lines...) Expand all Loading... |
36 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H__ | 36 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H__ |
37 | 37 |
38 #include "build/build_config.h" | 38 #include "build/build_config.h" |
39 | 39 |
40 #include <string> | 40 #include <string> |
41 #include <map> | 41 #include <map> |
42 #include <set> | 42 #include <set> |
43 #include <vector> | 43 #include <vector> |
44 | 44 |
45 #include "base/basictypes.h" | 45 #include "base/basictypes.h" |
| 46 #include "base/file_path.h" |
46 #include "base/hash_tables.h" | 47 #include "base/hash_tables.h" |
47 #include "base/observer_list.h" | 48 #include "base/observer_list.h" |
48 #include "base/ref_counted.h" | 49 #include "base/ref_counted.h" |
49 #include "chrome/browser/cancelable_request.h" | 50 #include "chrome/browser/cancelable_request.h" |
50 #include "chrome/browser/history/download_types.h" | 51 #include "chrome/browser/history/download_types.h" |
51 #include "chrome/browser/history/history.h" | 52 #include "chrome/browser/history/history.h" |
52 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
53 // TODO(port): Port this header and remove #ifdef. | 54 // TODO(port): Port this header and remove #ifdef. |
54 #include "chrome/browser/shell_dialogs.h" | 55 #include "chrome/browser/shell_dialogs.h" |
55 #endif | 56 #endif |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 class Observer { | 96 class Observer { |
96 public: | 97 public: |
97 virtual void OnDownloadUpdated(DownloadItem* download) = 0; | 98 virtual void OnDownloadUpdated(DownloadItem* download) = 0; |
98 }; | 99 }; |
99 | 100 |
100 // Constructing from persistent store: | 101 // Constructing from persistent store: |
101 DownloadItem(const DownloadCreateInfo& info); | 102 DownloadItem(const DownloadCreateInfo& info); |
102 | 103 |
103 // Constructing from user action: | 104 // Constructing from user action: |
104 DownloadItem(int32 download_id, | 105 DownloadItem(int32 download_id, |
105 const std::wstring& path, | 106 const FilePath& path, |
106 int path_uniquifier, | 107 int path_uniquifier, |
107 const std::wstring& url, | 108 const std::wstring& url, |
108 const std::wstring& original_name, | 109 const FilePath& original_name, |
109 const base::Time start_time, | 110 const base::Time start_time, |
110 int64 download_size, | 111 int64 download_size, |
111 int render_process_id, | 112 int render_process_id, |
112 int request_id, | 113 int request_id, |
113 bool is_dangerous); | 114 bool is_dangerous); |
114 | 115 |
115 ~DownloadItem(); | 116 ~DownloadItem(); |
116 | 117 |
117 void Init(bool start_timer); | 118 void Init(bool start_timer); |
118 | 119 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 158 |
158 // Simple speed estimate in bytes/s | 159 // Simple speed estimate in bytes/s |
159 int64 CurrentSpeed() const; | 160 int64 CurrentSpeed() const; |
160 | 161 |
161 // Rough percent complete, -1 means we don't know (since we didn't receive a | 162 // Rough percent complete, -1 means we don't know (since we didn't receive a |
162 // total size). | 163 // total size). |
163 int PercentComplete() const; | 164 int PercentComplete() const; |
164 | 165 |
165 // Update the download's path, the actual file is renamed on the download | 166 // Update the download's path, the actual file is renamed on the download |
166 // thread. | 167 // thread. |
167 void Rename(const std::wstring& full_path); | 168 void Rename(const FilePath& full_path); |
168 | 169 |
169 // Allow the user to temporarily pause a download or resume a paused download. | 170 // Allow the user to temporarily pause a download or resume a paused download. |
170 void TogglePause(); | 171 void TogglePause(); |
171 | 172 |
172 // Accessors | 173 // Accessors |
173 DownloadState state() const { return state_; } | 174 DownloadState state() const { return state_; } |
174 std::wstring file_name() const { return file_name_; } | 175 FilePath file_name() const { return file_name_; } |
175 void set_file_name(const std::wstring& name) { file_name_ = name; } | 176 void set_file_name(const FilePath& name) { file_name_ = name; } |
176 std::wstring full_path() const { return full_path_; } | 177 FilePath full_path() const { return full_path_; } |
177 void set_full_path(const std::wstring& path) { full_path_ = path; } | 178 void set_full_path(const FilePath& path) { full_path_ = path; } |
178 int path_uniquifier() const { return path_uniquifier_; } | 179 int path_uniquifier() const { return path_uniquifier_; } |
179 void set_path_uniquifier(int uniquifier) { path_uniquifier_ = uniquifier; } | 180 void set_path_uniquifier(int uniquifier) { path_uniquifier_ = uniquifier; } |
180 std::wstring url() const { return url_; } | 181 std::wstring url() const { return url_; } |
181 int64 total_bytes() const { return total_bytes_; } | 182 int64 total_bytes() const { return total_bytes_; } |
182 void set_total_bytes(int64 total_bytes) { total_bytes_ = total_bytes; } | 183 void set_total_bytes(int64 total_bytes) { total_bytes_ = total_bytes; } |
183 int64 received_bytes() const { return received_bytes_; } | 184 int64 received_bytes() const { return received_bytes_; } |
184 int32 id() const { return id_; } | 185 int32 id() const { return id_; } |
185 base::Time start_time() const { return start_time_; } | 186 base::Time start_time() const { return start_time_; } |
186 void set_db_handle(int64 handle) { db_handle_ = handle; } | 187 void set_db_handle(int64 handle) { db_handle_ = handle; } |
187 int64 db_handle() const { return db_handle_; } | 188 int64 db_handle() const { return db_handle_; } |
188 DownloadManager* manager() const { return manager_; } | 189 DownloadManager* manager() const { return manager_; } |
189 void set_manager(DownloadManager* manager) { manager_ = manager; } | 190 void set_manager(DownloadManager* manager) { manager_ = manager; } |
190 bool is_paused() const { return is_paused_; } | 191 bool is_paused() const { return is_paused_; } |
191 void set_is_paused(bool pause) { is_paused_ = pause; } | 192 void set_is_paused(bool pause) { is_paused_ = pause; } |
192 bool open_when_complete() const { return open_when_complete_; } | 193 bool open_when_complete() const { return open_when_complete_; } |
193 void set_open_when_complete(bool open) { open_when_complete_ = open; } | 194 void set_open_when_complete(bool open) { open_when_complete_ = open; } |
194 int render_process_id() const { return render_process_id_; } | 195 int render_process_id() const { return render_process_id_; } |
195 int request_id() const { return request_id_; } | 196 int request_id() const { return request_id_; } |
196 SafetyState safety_state() const { return safety_state_; } | 197 SafetyState safety_state() const { return safety_state_; } |
197 void set_safety_state(SafetyState safety_state) { | 198 void set_safety_state(SafetyState safety_state) { |
198 safety_state_ = safety_state; | 199 safety_state_ = safety_state; |
199 } | 200 } |
200 std::wstring original_name() const { return original_name_; } | 201 FilePath original_name() const { return original_name_; } |
201 void set_original_name(const std::wstring& name) { original_name_ = name; } | 202 void set_original_name(const FilePath& name) { original_name_ = name; } |
202 | 203 |
203 // Returns the file-name that should be reported to the user, which is | 204 // Returns the file-name that should be reported to the user, which is |
204 // file_name_ for safe downloads and original_name_ for dangerous ones with | 205 // file_name_ for safe downloads and original_name_ for dangerous ones with |
205 // the uniquifier number. | 206 // the uniquifier number. |
206 std::wstring GetFileName() const; | 207 FilePath GetFileName() const; |
207 | 208 |
208 private: | 209 private: |
209 // Internal helper for maintaining consistent received and total sizes. | 210 // Internal helper for maintaining consistent received and total sizes. |
210 void UpdateSize(int64 size); | 211 void UpdateSize(int64 size); |
211 | 212 |
212 // Request ID assigned by the ResourceDispatcherHost. | 213 // Request ID assigned by the ResourceDispatcherHost. |
213 int32 id_; | 214 int32 id_; |
214 | 215 |
215 // Full path to the downloaded file | 216 // Full path to the downloaded file |
216 std::wstring full_path_; | 217 FilePath full_path_; |
217 | 218 |
218 // A number that should be appended to the path to make it unique, or 0 if the | 219 // A number that should be appended to the path to make it unique, or 0 if the |
219 // path should be used as is. | 220 // path should be used as is. |
220 int path_uniquifier_; | 221 int path_uniquifier_; |
221 | 222 |
222 // Short display version of the file | 223 // Short display version of the file |
223 std::wstring file_name_; | 224 FilePath file_name_; |
224 | 225 |
225 // The URL from whence we came, for display | 226 // The URL from whence we came, for display |
226 std::wstring url_; | 227 std::wstring url_; |
227 | 228 |
228 // Total bytes expected | 229 // Total bytes expected |
229 int64 total_bytes_; | 230 int64 total_bytes_; |
230 | 231 |
231 // Current received bytes | 232 // Current received bytes |
232 int64 received_bytes_; | 233 int64 received_bytes_; |
233 | 234 |
(...skipping 23 matching lines...) Expand all Loading... |
257 | 258 |
258 // A flag for indicating if the download should be opened at completion. | 259 // A flag for indicating if the download should be opened at completion. |
259 bool open_when_complete_; | 260 bool open_when_complete_; |
260 | 261 |
261 // Whether the download is considered potentially safe or dangerous | 262 // Whether the download is considered potentially safe or dangerous |
262 // (executable files are typically considered dangerous). | 263 // (executable files are typically considered dangerous). |
263 SafetyState safety_state_; | 264 SafetyState safety_state_; |
264 | 265 |
265 // Dangerous download are given temporary names until the user approves them. | 266 // Dangerous download are given temporary names until the user approves them. |
266 // This stores their original name. | 267 // This stores their original name. |
267 std::wstring original_name_; | 268 FilePath original_name_; |
268 | 269 |
269 // For canceling or pausing requests. | 270 // For canceling or pausing requests. |
270 int render_process_id_; | 271 int render_process_id_; |
271 int request_id_; | 272 int request_id_; |
272 | 273 |
273 DISALLOW_EVIL_CONSTRUCTORS(DownloadItem); | 274 DISALLOW_EVIL_CONSTRUCTORS(DownloadItem); |
274 }; | 275 }; |
275 | 276 |
276 | 277 |
277 // DownloadManager ------------------------------------------------------------- | 278 // DownloadManager ------------------------------------------------------------- |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 365 |
365 // Show or Open a download via the Windows shell. | 366 // Show or Open a download via the Windows shell. |
366 void ShowDownloadInShell(const DownloadItem* download); | 367 void ShowDownloadInShell(const DownloadItem* download); |
367 void OpenDownloadInShell(const DownloadItem* download, HWND parent_window); | 368 void OpenDownloadInShell(const DownloadItem* download, HWND parent_window); |
368 | 369 |
369 // The number of in progress (including paused) downloads. | 370 // The number of in progress (including paused) downloads. |
370 int in_progress_count() const { | 371 int in_progress_count() const { |
371 return static_cast<int>(in_progress_.size()); | 372 return static_cast<int>(in_progress_.size()); |
372 } | 373 } |
373 | 374 |
374 std::wstring download_path() { return *download_path_; } | 375 FilePath download_path() { |
| 376 return FilePath::FromWStringHack(*download_path_); |
| 377 } |
375 | 378 |
376 // Clears the last download path, used to initialize "save as" dialogs. | 379 // Clears the last download path, used to initialize "save as" dialogs. |
377 void ClearLastDownloadPath(); | 380 void ClearLastDownloadPath(); |
378 | 381 |
379 // Registers this file extension for automatic opening upon download | 382 // Registers this file extension for automatic opening upon download |
380 // completion if 'open' is true, or prevents the extension from automatic | 383 // completion if 'open' is true, or prevents the extension from automatic |
381 // opening if 'open' is false. | 384 // opening if 'open' is false. |
382 void OpenFilesOfExtension(const std::wstring& extension, bool open); | 385 void OpenFilesOfExtension(const FilePath::StringType& extension, bool open); |
383 | 386 |
384 // Tests if a file type should be opened automatically. | 387 // Tests if a file type should be opened automatically. |
385 bool ShouldOpenFileExtension(const std::wstring& extension); | 388 bool ShouldOpenFileExtension(const FilePath::StringType& extension); |
386 | 389 |
387 // Tests if we think the server means for this mime_type to be executable. | 390 // Tests if we think the server means for this mime_type to be executable. |
388 static bool IsExecutableMimeType(const std::string& mime_type); | 391 static bool IsExecutableMimeType(const std::string& mime_type); |
389 | 392 |
390 // Tests if a file type is considered executable. | 393 // Tests if a file type is considered executable. |
391 bool IsExecutable(const std::wstring& extension); | 394 bool IsExecutable(const FilePath::StringType& extension); |
392 | 395 |
393 // Resets the automatic open preference. | 396 // Resets the automatic open preference. |
394 void ResetAutoOpenFiles(); | 397 void ResetAutoOpenFiles(); |
395 | 398 |
396 // Returns true if there are automatic handlers registered for any file | 399 // Returns true if there are automatic handlers registered for any file |
397 // types. | 400 // types. |
398 bool HasAutoOpenFileTypesRegistered() const; | 401 bool HasAutoOpenFileTypesRegistered() const; |
399 | 402 |
400 // Overridden from SelectFileDialog::Listener: | 403 // Overridden from SelectFileDialog::Listener: |
| 404 // TODO(port): convert this to FilePath when SelectFileDialog gets converted. |
401 virtual void FileSelected(const std::wstring& path, void* params); | 405 virtual void FileSelected(const std::wstring& path, void* params); |
402 virtual void FileSelectionCanceled(void* params); | 406 virtual void FileSelectionCanceled(void* params); |
403 | 407 |
404 // Deletes the specified path on the file thread. | 408 // Deletes the specified path on the file thread. |
405 void DeleteDownload(const std::wstring& path); | 409 void DeleteDownload(const FilePath& path); |
406 | 410 |
407 // Called when the user has validated the donwload of a dangerous file. | 411 // Called when the user has validated the donwload of a dangerous file. |
408 void DangerousDownloadValidated(DownloadItem* download); | 412 void DangerousDownloadValidated(DownloadItem* download); |
409 | 413 |
410 // Used to make sure we have a safe file extension and filename for a | 414 // Used to make sure we have a safe file extension and filename for a |
411 // download. |file_name| can either be just the file name or it can be a | 415 // download. |file_name| can either be just the file name or it can be a |
412 // full path to a file. | 416 // full path to a file. |
413 void GenerateSafeFilename(const std::string& mime_type, | 417 void GenerateSafeFilename(const std::string& mime_type, |
414 std::wstring* file_name); | 418 FilePath* file_name); |
415 | 419 |
416 private: | 420 private: |
417 // Shutdown the download manager. This call is needed only after Init. | 421 // Shutdown the download manager. This call is needed only after Init. |
418 void Shutdown(); | 422 void Shutdown(); |
419 | 423 |
420 // Called on the download thread to check whether the suggested file path | 424 // Called on the download thread to check whether the suggested file path |
421 // exists. We don't check if the file exists on the UI thread to avoid UI | 425 // exists. We don't check if the file exists on the UI thread to avoid UI |
422 // stalls from interacting with the file system. | 426 // stalls from interacting with the file system. |
423 void CheckIfSuggestedPathExists(DownloadCreateInfo* info); | 427 void CheckIfSuggestedPathExists(DownloadCreateInfo* info); |
424 | 428 |
425 // Called on the UI thread once the DownloadManager has determined whether the | 429 // Called on the UI thread once the DownloadManager has determined whether the |
426 // suggested file path exists. | 430 // suggested file path exists. |
427 void OnPathExistenceAvailable(DownloadCreateInfo* info); | 431 void OnPathExistenceAvailable(DownloadCreateInfo* info); |
428 | 432 |
429 // Called back after a target path for the file to be downloaded to has been | 433 // Called back after a target path for the file to be downloaded to has been |
430 // determined, either automatically based on the suggested file name, or by | 434 // determined, either automatically based on the suggested file name, or by |
431 // the user in a Save As dialog box. | 435 // the user in a Save As dialog box. |
432 void ContinueStartDownload(DownloadCreateInfo* info, | 436 void ContinueStartDownload(DownloadCreateInfo* info, |
433 const std::wstring& target_path); | 437 const FilePath& target_path); |
434 | 438 |
435 // Update the history service for a particular download. | 439 // Update the history service for a particular download. |
436 void UpdateHistoryForDownload(DownloadItem* download); | 440 void UpdateHistoryForDownload(DownloadItem* download); |
437 void RemoveDownloadFromHistory(DownloadItem* download); | 441 void RemoveDownloadFromHistory(DownloadItem* download); |
438 void RemoveDownloadsFromHistoryBetween(const base::Time remove_begin, | 442 void RemoveDownloadsFromHistoryBetween(const base::Time remove_begin, |
439 const base::Time remove_before); | 443 const base::Time remove_before); |
440 | 444 |
441 // Inform the notification service of download starts and stops. | 445 // Inform the notification service of download starts and stops. |
442 void NotifyAboutDownloadStart(); | 446 void NotifyAboutDownloadStart(); |
443 void NotifyAboutDownloadStop(); | 447 void NotifyAboutDownloadStop(); |
444 | 448 |
445 // Create an extension based on the file name and mime type. | 449 // Create an extension based on the file name and mime type. |
446 void GenerateExtension(const std::wstring& file_name, | 450 void GenerateExtension(const FilePath& file_name, |
447 const std::string& mime_type, | 451 const std::string& mime_type, |
448 std::wstring* generated_extension); | 452 FilePath::StringType* generated_extension); |
449 | 453 |
450 // Create a file name based on the response from the server. | 454 // Create a file name based on the response from the server. |
451 void GenerateFilename(DownloadCreateInfo* info, std::wstring* generated_name); | 455 void GenerateFilename(DownloadCreateInfo* info, FilePath* generated_name); |
452 | 456 |
453 // Persist the automatic opening preference. | 457 // Persist the automatic opening preference. |
454 void SaveAutoOpens(); | 458 void SaveAutoOpens(); |
455 | 459 |
456 // Runs the network cancel on the IO thread. | 460 // Runs the network cancel on the IO thread. |
457 static void OnCancelDownloadRequest(ResourceDispatcherHost* rdh, | 461 static void OnCancelDownloadRequest(ResourceDispatcherHost* rdh, |
458 int render_process_id, | 462 int render_process_id, |
459 int request_id); | 463 int request_id); |
460 | 464 |
461 // Runs the pause on the IO thread. | 465 // Runs the pause on the IO thread. |
462 static void OnPauseDownloadRequest(ResourceDispatcherHost* rdh, | 466 static void OnPauseDownloadRequest(ResourceDispatcherHost* rdh, |
463 int render_process_id, | 467 int render_process_id, |
464 int request_id, | 468 int request_id, |
465 bool pause); | 469 bool pause); |
466 | 470 |
467 // Performs the last steps required when a download has been completed. | 471 // Performs the last steps required when a download has been completed. |
468 // It is necessary to break down the flow when a download is finished as | 472 // It is necessary to break down the flow when a download is finished as |
469 // dangerous downloads are downloaded to temporary files that need to be | 473 // dangerous downloads are downloaded to temporary files that need to be |
470 // renamed on the file thread first. | 474 // renamed on the file thread first. |
471 // Invoked on the UI thread. | 475 // Invoked on the UI thread. |
472 void ContinueDownloadFinished(DownloadItem* download); | 476 void ContinueDownloadFinished(DownloadItem* download); |
473 | 477 |
474 // Renames a finished dangerous download from its temporary file name to its | 478 // Renames a finished dangerous download from its temporary file name to its |
475 // real file name. | 479 // real file name. |
476 // Invoked on the file thread. | 480 // Invoked on the file thread. |
477 void ProceedWithFinishedDangerousDownload(int64 download_handle, | 481 void ProceedWithFinishedDangerousDownload(int64 download_handle, |
478 const std::wstring& path, | 482 const FilePath& path, |
479 const std::wstring& original_name); | 483 const FilePath& original_name); |
480 | 484 |
481 // Invoked on the UI thread when a dangerous downloaded file has been renamed. | 485 // Invoked on the UI thread when a dangerous downloaded file has been renamed. |
482 void DangerousDownloadRenamed(int64 download_handle, | 486 void DangerousDownloadRenamed(int64 download_handle, |
483 bool success, | 487 bool success, |
484 const std::wstring& new_path, | 488 const FilePath& new_path, |
485 int new_path_uniquifier); | 489 int new_path_uniquifier); |
486 | 490 |
487 // Checks whether a file represents a risk if downloaded. | 491 // Checks whether a file represents a risk if downloaded. |
488 bool IsDangerous(const std::wstring& file_name); | 492 bool IsDangerous(const FilePath& file_name); |
489 | 493 |
490 // Changes the paths and file name of the specified |download|, propagating | 494 // Changes the paths and file name of the specified |download|, propagating |
491 // the change to the history system. | 495 // the change to the history system. |
492 void RenameDownload(DownloadItem* download, const std::wstring& new_path); | 496 void RenameDownload(DownloadItem* download, const FilePath& new_path); |
493 | 497 |
494 // 'downloads_' is map of all downloads in this profile. The key is the handle | 498 // 'downloads_' is map of all downloads in this profile. The key is the handle |
495 // returned by the history system, which is unique across sessions. This map | 499 // returned by the history system, which is unique across sessions. This map |
496 // owns all the DownloadItems once they have been created in the history | 500 // owns all the DownloadItems once they have been created in the history |
497 // system. | 501 // system. |
498 // | 502 // |
499 // 'in_progress_' is a map of all downloads that are in progress and that have | 503 // 'in_progress_' is a map of all downloads that are in progress and that have |
500 // not yet received a valid history handle. The key is the ID assigned by the | 504 // not yet received a valid history handle. The key is the ID assigned by the |
501 // ResourceDispatcherHost, which is unique for the current session. This map | 505 // ResourceDispatcherHost, which is unique for the current session. This map |
502 // does not own the DownloadItems. | 506 // does not own the DownloadItems. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 // A pointer to the file thread's loop. The file thread lives longer than | 546 // A pointer to the file thread's loop. The file thread lives longer than |
543 // the DownloadManager, so this is safe to cache. | 547 // the DownloadManager, so this is safe to cache. |
544 MessageLoop* file_loop_; | 548 MessageLoop* file_loop_; |
545 | 549 |
546 // User preferences | 550 // User preferences |
547 BooleanPrefMember prompt_for_download_; | 551 BooleanPrefMember prompt_for_download_; |
548 StringPrefMember download_path_; | 552 StringPrefMember download_path_; |
549 | 553 |
550 // The user's last choice for download directory. This is only used when the | 554 // The user's last choice for download directory. This is only used when the |
551 // user wants us to prompt for a save location for each download. | 555 // user wants us to prompt for a save location for each download. |
552 std::wstring last_download_path_; | 556 FilePath last_download_path_; |
553 | 557 |
554 // Set of file extensions to open at download completion. | 558 // Set of file extensions to open at download completion. |
555 std::set<std::wstring> auto_open_; | 559 std::set<FilePath::StringType> auto_open_; |
556 | 560 |
557 // Set of file extensions that are executables and shouldn't be auto opened. | 561 // Set of file extensions that are executables and shouldn't be auto opened. |
558 std::set<std::wstring> exe_types_; | 562 std::set<FilePath::StringType> exe_types_; |
559 | 563 |
560 // Keep track of downloads that are completed before the user selects the | 564 // Keep track of downloads that are completed before the user selects the |
561 // destination, so that observers are appropriately notified of completion | 565 // destination, so that observers are appropriately notified of completion |
562 // after this determination is made. | 566 // after this determination is made. |
563 // The map is of download_id->remaining size (bytes), both of which are | 567 // The map is of download_id->remaining size (bytes), both of which are |
564 // required when calling DownloadFinished. | 568 // required when calling DownloadFinished. |
565 typedef std::map<int32, int64> PendingFinishedMap; | 569 typedef std::map<int32, int64> PendingFinishedMap; |
566 PendingFinishedMap pending_finished_downloads_; | 570 PendingFinishedMap pending_finished_downloads_; |
567 | 571 |
568 // The "Save As" dialog box used to ask the user where a file should be | 572 // The "Save As" dialog box used to ask the user where a file should be |
569 // saved. | 573 // saved. |
570 scoped_refptr<SelectFileDialog> select_file_dialog_; | 574 scoped_refptr<SelectFileDialog> select_file_dialog_; |
571 | 575 |
572 DISALLOW_EVIL_CONSTRUCTORS(DownloadManager); | 576 DISALLOW_EVIL_CONSTRUCTORS(DownloadManager); |
573 }; | 577 }; |
574 | 578 |
575 #endif // defined(OS_WIN) | 579 #endif // defined(OS_WIN) |
576 | 580 |
577 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H__ | 581 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H__ |
OLD | NEW |