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

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

Issue 10069014: Save Page As MHTML (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 years, 7 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 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/logging.h"
12 #include "base/time.h" 13 #include "base/time.h"
13 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
14 #include "content/public/browser/save_page_type.h" 15 #include "content/public/browser/save_page_type.h"
15 16
16 namespace content { 17 namespace content {
17 18
18 class DownloadId; 19 class DownloadId;
19 class DownloadItem; 20 class DownloadItem;
20 class WebContents; 21 class WebContents;
21 22
22 typedef base::Callback<void(const FilePath&, content::SavePageType)> 23 // Called by SavePackage when it creates a DownloadItem.
23 SaveFilePathPickedCallback; 24 typedef base::Callback<void(DownloadItem*)>
25 SavePackageDownloadCreatedCallback;
26
27 // Will be called asynchronously with the results of the ChooseSavePath
28 // operation. If the delegate wants notification of the download item created
29 // in response to this operation, the SavePackageDownloadCreatedCallback will be
30 // non-null.
31 typedef base::Callback<void(const FilePath&,
32 content::SavePageType,
33 const SavePackageDownloadCreatedCallback&)>
34 SavePackagePathPickedCallback;
24 35
25 // Browser's download manager: manages all downloads and destination view. 36 // Browser's download manager: manages all downloads and destination view.
26 class CONTENT_EXPORT DownloadManagerDelegate { 37 class CONTENT_EXPORT DownloadManagerDelegate {
27 public: 38 public:
28 virtual ~DownloadManagerDelegate() {} 39 virtual ~DownloadManagerDelegate();
29 40
30 // Lets the delegate know that the download manager is shutting down. 41 // Lets the delegate know that the download manager is shutting down.
31 virtual void Shutdown() {} 42 virtual void Shutdown() {}
32 43
33 // Returns a new DownloadId. 44 // Returns a new DownloadId.
34 virtual DownloadId GetNextId(); 45 virtual DownloadId GetNextId();
35 46
36 // Notifies the delegate that a download is starting. The delegate can return 47 // Notifies the delegate that a download is starting. The delegate can return
37 // false to delay the start of the download, in which case it should call 48 // false to delay the start of the download, in which case it should call
38 // DownloadManager::RestartDownload when it's ready. 49 // DownloadManager::RestartDownload when it's ready.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 virtual void RemoveItemsFromPersistentStoreBetween( 113 virtual void RemoveItemsFromPersistentStoreBetween(
103 base::Time remove_begin, 114 base::Time remove_begin,
104 base::Time remove_end) {} 115 base::Time remove_end) {}
105 116
106 // Retrieve the directories to save html pages and downloads to. 117 // Retrieve the directories to save html pages and downloads to.
107 virtual void GetSaveDir(WebContents* web_contents, 118 virtual void GetSaveDir(WebContents* web_contents,
108 FilePath* website_save_dir, 119 FilePath* website_save_dir,
109 FilePath* download_save_dir) {} 120 FilePath* download_save_dir) {}
110 121
111 // Asks the user for the path to save a page. The delegate calls the callback 122 // Asks the user for the path to save a page. The delegate calls the callback
112 // to give the answer, except on ChromeOS, where the saving is done by 123 // to give the answer.
113 // SavePackageFilePickerChromeOS. TODO(achuith): Move ChromeOS save
114 // functionality to SavePackage.
115 virtual void ChooseSavePath(WebContents* web_contents, 124 virtual void ChooseSavePath(WebContents* web_contents,
116 const FilePath& suggested_path, 125 const FilePath& suggested_path,
117 const FilePath::StringType& default_extension, 126 const FilePath::StringType& default_extension,
118 bool can_save_as_complete, 127 bool can_save_as_complete,
119 SaveFilePathPickedCallback callback) {} 128 const SavePackagePathPickedCallback& callback) {
129 }
120 }; 130 };
121 131
122 } // namespace content 132 } // namespace content
123 133
124 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ 134 #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