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

Side by Side Diff: content/public/browser/download_manager_delegate.h

Issue 12286020: Replace FilePath with base::FilePath. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_
6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ 6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 11 matching lines...) Expand all
22 class WebContents; 22 class WebContents;
23 23
24 // Called by SavePackage when it creates a DownloadItem. 24 // Called by SavePackage when it creates a DownloadItem.
25 typedef base::Callback<void(DownloadItem*)> 25 typedef base::Callback<void(DownloadItem*)>
26 SavePackageDownloadCreatedCallback; 26 SavePackageDownloadCreatedCallback;
27 27
28 // Will be called asynchronously with the results of the ChooseSavePath 28 // Will be called asynchronously with the results of the ChooseSavePath
29 // operation. If the delegate wants notification of the download item created 29 // operation. If the delegate wants notification of the download item created
30 // in response to this operation, the SavePackageDownloadCreatedCallback will be 30 // in response to this operation, the SavePackageDownloadCreatedCallback will be
31 // non-null. 31 // non-null.
32 typedef base::Callback<void(const FilePath&, 32 typedef base::Callback<void(const base::FilePath&,
33 SavePageType, 33 SavePageType,
34 const SavePackageDownloadCreatedCallback&)> 34 const SavePackageDownloadCreatedCallback&)>
35 SavePackagePathPickedCallback; 35 SavePackagePathPickedCallback;
36 36
37 // Called with the results of DetermineDownloadTarget(). If the delegate decides 37 // Called with the results of DetermineDownloadTarget(). If the delegate decides
38 // to cancel the download, then |target_path| should be set to an empty path. If 38 // to cancel the download, then |target_path| should be set to an empty path. If
39 // |target_path| is non-empty, then |intermediate_path| is required to be 39 // |target_path| is non-empty, then |intermediate_path| is required to be
40 // non-empty and specify the path to the intermediate file (which could be the 40 // non-empty and specify the path to the intermediate file (which could be the
41 // same as |target_path|). Both |target_path| and |intermediate_path| are 41 // same as |target_path|). Both |target_path| and |intermediate_path| are
42 // expected to in the same directory. 42 // expected to in the same directory.
43 typedef base::Callback<void( 43 typedef base::Callback<void(
44 const FilePath& target_path, 44 const base::FilePath& target_path,
45 DownloadItem::TargetDisposition disposition, 45 DownloadItem::TargetDisposition disposition,
46 DownloadDangerType danger_type, 46 DownloadDangerType danger_type,
47 const FilePath& intermediate_path)> DownloadTargetCallback; 47 const base::FilePath& intermediate_path)> DownloadTargetCallback;
48 48
49 // Called when a download delayed by the delegate has completed. 49 // Called when a download delayed by the delegate has completed.
50 typedef base::Callback<void(bool)> DownloadOpenDelayedCallback; 50 typedef base::Callback<void(bool)> DownloadOpenDelayedCallback;
51 51
52 // Called with the reuslt of CheckForFileExistence(). 52 // Called with the reuslt of CheckForFileExistence().
53 typedef base::Callback<void(bool result)> CheckForFileExistenceCallback; 53 typedef base::Callback<void(bool result)> CheckForFileExistenceCallback;
54 54
55 // Browser's download manager: manages all downloads and destination view. 55 // Browser's download manager: manages all downloads and destination view.
56 class CONTENT_EXPORT DownloadManagerDelegate { 56 class CONTENT_EXPORT DownloadManagerDelegate {
57 public: 57 public:
(...skipping 18 matching lines...) Expand all
76 // empty |target_path| argument. 76 // empty |target_path| argument.
77 virtual bool DetermineDownloadTarget(DownloadItem* item, 77 virtual bool DetermineDownloadTarget(DownloadItem* item,
78 const DownloadTargetCallback& callback); 78 const DownloadTargetCallback& callback);
79 79
80 // Called when the download system wants to alert a WebContents that a 80 // Called when the download system wants to alert a WebContents that a
81 // download has started, but the TabConetnts has gone away. This lets an 81 // download has started, but the TabConetnts has gone away. This lets an
82 // delegate return an alternative WebContents. The delegate can return NULL. 82 // delegate return an alternative WebContents. The delegate can return NULL.
83 virtual WebContents* GetAlternativeWebContentsToNotifyForDownload(); 83 virtual WebContents* GetAlternativeWebContentsToNotifyForDownload();
84 84
85 // Tests if a file type should be opened automatically. 85 // Tests if a file type should be opened automatically.
86 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path); 86 virtual bool ShouldOpenFileBasedOnExtension(const base::FilePath& path);
87 87
88 // Allows the delegate to delay completion of the download. This function 88 // Allows the delegate to delay completion of the download. This function
89 // will either return true (in which case the download may complete) 89 // will either return true (in which case the download may complete)
90 // or will call the callback passed when the download is ready for 90 // or will call the callback passed when the download is ready for
91 // completion. This routine may be called multiple times; once the callback 91 // completion. This routine may be called multiple times; once the callback
92 // has been called or the function has returned true for a particular 92 // has been called or the function has returned true for a particular
93 // download it should continue to return true for that download. 93 // download it should continue to return true for that download.
94 virtual bool ShouldCompleteDownload( 94 virtual bool ShouldCompleteDownload(
95 DownloadItem* item, 95 DownloadItem* item,
96 const base::Closure& complete_callback); 96 const base::Closure& complete_callback);
97 97
98 // Allows the delegate to override opening the download. If this function 98 // Allows the delegate to override opening the download. If this function
99 // returns false, the delegate needs to call callback when it's done 99 // returns false, the delegate needs to call callback when it's done
100 // with the item, and is responsible for opening it. This function is called 100 // with the item, and is responsible for opening it. This function is called
101 // after the final rename, but before the download state is set to COMPLETED. 101 // after the final rename, but before the download state is set to COMPLETED.
102 virtual bool ShouldOpenDownload(DownloadItem* item, 102 virtual bool ShouldOpenDownload(DownloadItem* item,
103 const DownloadOpenDelayedCallback& callback); 103 const DownloadOpenDelayedCallback& callback);
104 104
105 // Returns true if we need to generate a binary hash for downloads. 105 // Returns true if we need to generate a binary hash for downloads.
106 virtual bool GenerateFileHash(); 106 virtual bool GenerateFileHash();
107 107
108 // Retrieve the directories to save html pages and downloads to. 108 // Retrieve the directories to save html pages and downloads to.
109 virtual void GetSaveDir(BrowserContext* browser_context, 109 virtual void GetSaveDir(BrowserContext* browser_context,
110 FilePath* website_save_dir, 110 base::FilePath* website_save_dir,
111 FilePath* download_save_dir, 111 base::FilePath* download_save_dir,
112 bool* skip_dir_check) {} 112 bool* skip_dir_check) {}
113 113
114 // Asks the user for the path to save a page. The delegate calls the callback 114 // Asks the user for the path to save a page. The delegate calls the callback
115 // to give the answer. 115 // to give the answer.
116 virtual void ChooseSavePath(WebContents* web_contents, 116 virtual void ChooseSavePath(
117 const FilePath& suggested_path, 117 WebContents* web_contents,
118 const FilePath::StringType& default_extension, 118 const base::FilePath& suggested_path,
119 bool can_save_as_complete, 119 const base::FilePath::StringType& default_extension,
120 const SavePackagePathPickedCallback& callback) { 120 bool can_save_as_complete,
121 const SavePackagePathPickedCallback& callback) {
121 } 122 }
122 123
123 // Opens the file associated with this download. 124 // Opens the file associated with this download.
124 virtual void OpenDownload(DownloadItem* download) {} 125 virtual void OpenDownload(DownloadItem* download) {}
125 126
126 // Shows the download via the OS shell. 127 // Shows the download via the OS shell.
127 virtual void ShowDownloadInShell(DownloadItem* download) {} 128 virtual void ShowDownloadInShell(DownloadItem* download) {}
128 129
129 // Checks whether a downloaded file still exists. 130 // Checks whether a downloaded file still exists.
130 virtual void CheckForFileExistence( 131 virtual void CheckForFileExistence(
131 DownloadItem* download, 132 DownloadItem* download,
132 const CheckForFileExistenceCallback& callback) {} 133 const CheckForFileExistenceCallback& callback) {}
133 134
134 protected: 135 protected:
135 virtual ~DownloadManagerDelegate(); 136 virtual ~DownloadManagerDelegate();
136 }; 137 };
137 138
138 } // namespace content 139 } // namespace content
139 140
140 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ 141 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_
OLDNEW
« no previous file with comments | « content/public/browser/download_manager.h ('k') | content/public/browser/download_manager_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698