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

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

Issue 6973052: When the download folder does not exist, change the download folder to a user's "Downloads" (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add ChooseSavableDirectory() and ScopedDefaultDownloadDirectory Created 9 years, 6 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 // 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 // Download observers: 10 // Download observers:
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // of downloads. 79 // of downloads.
80 virtual void ModelChanged() = 0; 80 virtual void ModelChanged() = 0;
81 81
82 // Called when the DownloadManager is being destroyed to prevent Observers 82 // Called when the DownloadManager is being destroyed to prevent Observers
83 // from calling back to a stale pointer. 83 // from calling back to a stale pointer.
84 virtual void ManagerGoingDown() {} 84 virtual void ManagerGoingDown() {}
85 85
86 // Called immediately after the DownloadManager puts up a select file 86 // Called immediately after the DownloadManager puts up a select file
87 // dialog. 87 // dialog.
88 // |id| indicates which download opened the dialog. 88 // |id| indicates which download opened the dialog.
89 virtual void SelectFileDialogDisplayed(int32 id) {} 89 // |suggested_path| indicates the path suggested in the dialog.
90 virtual void SelectFileDialogDisplayed(
91 int32 id, const FilePath& suggested_path) {}
90 92
91 protected: 93 protected:
92 virtual ~Observer() {} 94 virtual ~Observer() {}
93 }; 95 };
94 96
95 // Return all temporary downloads that reside in the specified directory. 97 // Return all temporary downloads that reside in the specified directory.
96 void GetTemporaryDownloads(const FilePath& dir_path, 98 void GetTemporaryDownloads(const FilePath& dir_path,
97 std::vector<DownloadItem*>* result); 99 std::vector<DownloadItem*>* result);
98 100
99 // Return all non-temporary downloads in the specified directory that are 101 // Return all non-temporary downloads in the specified directory that are
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 friend class DeleteTask<DownloadManager>; 280 friend class DeleteTask<DownloadManager>;
279 friend class OtherDownloadManagerObserver; 281 friend class OtherDownloadManagerObserver;
280 282
281 virtual ~DownloadManager(); 283 virtual ~DownloadManager();
282 284
283 // Called on the download thread to check whether the suggested file path 285 // Called on the download thread to check whether the suggested file path
284 // exists. We don't check if the file exists on the UI thread to avoid UI 286 // exists. We don't check if the file exists on the UI thread to avoid UI
285 // stalls from interacting with the file system. 287 // stalls from interacting with the file system.
286 void CheckIfSuggestedPathExists(int32 download_id, 288 void CheckIfSuggestedPathExists(int32 download_id,
287 DownloadStateInfo state, 289 DownloadStateInfo state,
288 const FilePath& default_path); 290 const FilePath& download_save_dir);
289 291
290 // Called on the UI thread once the DownloadManager has determined whether the 292 // Called on the UI thread once the DownloadManager has determined whether the
291 // suggested file path exists. 293 // suggested file path exists.
292 void OnPathExistenceAvailable(int32 download_id, 294 void OnPathExistenceAvailable(int32 download_id,
293 DownloadStateInfo new_state); 295 DownloadStateInfo new_state);
294 296
295 // Called back after a target path for the file to be downloaded to has been 297 // Called back after a target path for the file to be downloaded to has been
296 // determined, either automatically based on the suggested file name, or by 298 // determined, either automatically based on the suggested file name, or by
297 // the user in a Save As dialog box. 299 // the user in a Save As dialog box.
298 void ContinueDownloadWithPath(DownloadItem* download, 300 void ContinueDownloadWithPath(DownloadItem* download,
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 // The "Save As" dialog box used to ask the user where a file should be 413 // The "Save As" dialog box used to ask the user where a file should be
412 // saved. 414 // saved.
413 scoped_refptr<SelectFileDialog> select_file_dialog_; 415 scoped_refptr<SelectFileDialog> select_file_dialog_;
414 416
415 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; 417 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_;
416 418
417 DISALLOW_COPY_AND_ASSIGN(DownloadManager); 419 DISALLOW_COPY_AND_ASSIGN(DownloadManager);
418 }; 420 };
419 421
420 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ 422 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698