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

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

Issue 7640021: Move some Chrome-specific code paths out of DownloadManager and into the delegate. Getting rid of... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_DELEGATE_H_
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_DELEGATE_H_ 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_DELEGATE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 11
12 class DownloadManager;
13 class FilePath; 12 class FilePath;
14 class TabContents; 13 class TabContents;
15 class SavePackage; 14 class SavePackage;
16 15
17 // Browser's download manager: manages all downloads and destination view. 16 // Browser's download manager: manages all downloads and destination view.
18 class DownloadManagerDelegate { 17 class DownloadManagerDelegate {
19 public: 18 public:
19 // Notifies the delegate that a download is starting. The delegate can return
20 // false to delay the start of the download, in which case it should call
21 // DownloadManager::RestartDownload when it's ready.
22 virtual bool ShouldStartDownload(int32 download_id) = 0;
23
24 // Asks the user for the path for a download. The delegate calls
25 // DownloadManager::FileSelected or DownloadManager::FileSelectionCanceled to
26 // give the answer.
27 virtual void ChooseDownloadPath(TabContents* tab_contents,
28 const FilePath& suggested_path,
29 void* data) = 0;
30
31 // Called when the download system wants to alert a TabContents that a
32 // download has started, but the TabConetnts has gone away. This lets an
33 // embedder return an alternative TabContents. The embedder can return NULL.
34 virtual TabContents* GetAlternativeTabContentsToNotifyForDownload() = 0;
35
36 // Tests if a file type should be opened automatically.
37 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) = 0;
38
20 // Retrieve the directories to save html pages and downloads to. 39 // Retrieve the directories to save html pages and downloads to.
21 virtual void GetSaveDir(TabContents* tab_contents, 40 virtual void GetSaveDir(TabContents* tab_contents,
22 FilePath* website_save_dir, 41 FilePath* website_save_dir,
23 FilePath* download_save_dir) = 0; 42 FilePath* download_save_dir) = 0;
24 43
25 // Asks the user for the path to save a page. The embedder calls 44 // Asks the user for the path to save a page. The delegate calls
26 // SavePackage::OnPathPicked to give the answer. 45 // SavePackage::OnPathPicked to give the answer.
27 virtual void ChooseSavePath(const base::WeakPtr<SavePackage>& save_package, 46 virtual void ChooseSavePath(const base::WeakPtr<SavePackage>& save_package,
28 const FilePath& suggested_path, 47 const FilePath& suggested_path,
29 bool can_save_as_complete) = 0; 48 bool can_save_as_complete) = 0;
30 49
31 // Asks the user for the path for a download. The embedder calls
32 // DownloadManager::FileSelected or DownloadManager::FileSelectionCanceled to
33 // give the answer.
34 virtual void ChooseDownloadPath(DownloadManager* download_manager,
35 TabContents* tab_contents,
36 const FilePath& suggested_path,
37 void* data) = 0;
38
39 // Called when the download system wants to alert a TabContents that a
40 // download has started, but the TabContents has gone away. This lets an
41 // embedder return an alternative TabContents. The embedder can return NULL.
42 virtual TabContents* GetAlternativeTabContentsToNotifyForDownload(
43 DownloadManager* download_manager) = 0;
44
45 protected: 50 protected:
46 DownloadManagerDelegate() {} 51 DownloadManagerDelegate() {}
47 virtual ~DownloadManagerDelegate() {} 52 virtual ~DownloadManagerDelegate() {}
48 53
49 DISALLOW_COPY_AND_ASSIGN(DownloadManagerDelegate); 54 DISALLOW_COPY_AND_ASSIGN(DownloadManagerDelegate);
50 }; 55 };
51 56
52 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_DELEGATE_H_ 57 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_manager.cc ('k') | chrome/browser/download/download_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698