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

Unified Diff: chrome/browser/download/chrome_download_manager_delegate.h

Issue 11574006: Implement chrome.downloads.onDeterminingFilename() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r176065 Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/download/chrome_download_manager_delegate.h
diff --git a/chrome/browser/download/chrome_download_manager_delegate.h b/chrome/browser/download/chrome_download_manager_delegate.h
index 92241657f1f67a73e53a36f070d95599304a1e60..7054f1795669df4519eac1d557f96ae2940c427a 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.h
+++ b/chrome/browser/download/chrome_download_manager_delegate.h
@@ -19,7 +19,6 @@
#include "content/public/browser/notification_registrar.h"
class DownloadPrefs;
-class ExtensionDownloadsEventRouter;
class Profile;
namespace content {
@@ -136,6 +135,16 @@ class ChromeDownloadManagerDelegate
private:
friend class base::RefCountedThreadSafe<ChromeDownloadManagerDelegate>;
+ struct ContinueFilenameDeterminationInfo {
+ ContinueFilenameDeterminationInfo();
+ ~ContinueFilenameDeterminationInfo();
+ int32 download_id;
+ content::DownloadTargetCallback callback;
+ content::DownloadDangerType danger_type;
+ bool visited_referrer_before;
battre 2013/01/11 14:29:37 This and the following parameter are unclear to me
benjhayden 2013/01/11 21:21:27 I'll let Randy decide this.
+ bool should_prompt;
+ };
+
// content::NotificationObserver implementation.
virtual void Observe(int type,
const content::NotificationSource& source,
@@ -194,6 +203,22 @@ class ChromeDownloadManagerDelegate
const FilePath& reserved_path,
bool reserved_path_verified);
+ // When an extension opts to change a download's target filename, this
+ // sanitizes it before continuing with the filename determination process.
+ void OnExtensionsChangingFilename(
+ ContinueFilenameDeterminationInfo continue_info,
battre 2013/01/11 14:29:37 pass structs as const ref?
benjhayden 2013/01/11 21:21:27 Done.
+ const FilePath& changed_filename,
+ bool overwrite);
+
+ // When extensions either opt not to change a download's target filename, or
+ // the changed filename has been sanitized, this method continues with the
+ // filename determination process, optionally prompting the user to manually
+ // set the filename.
+ void OnExtensionsDeterminedFilename(
+ ContinueFilenameDeterminationInfo continue_info,
battre 2013/01/11 14:29:37 pass structs as const ref?
benjhayden 2013/01/11 21:21:27 Done.
+ const FilePath& suggested_path,
+ bool is_forced_path);
+
// Called on the UI thread once the final target path is available.
void OnTargetPathDetermined(
int32 download_id,
@@ -230,20 +255,6 @@ class ChromeDownloadManagerDelegate
content::NotificationRegistrar registrar_;
- // On Android, GET downloads are not handled by the DownloadManager.
- // Once we have extensions on android, we probably need the EventRouter
- // in ContentViewDownloadDelegate which knows about both GET and POST
- // downloads.
-#if !defined(OS_ANDROID)
- // The ExtensionDownloadsEventRouter dispatches download creation, change, and
- // erase events to extensions. Like ChromeDownloadManagerDelegate, it's a
- // chrome-level concept and its lifetime should match DownloadManager. There
- // should be a separate EDER for on-record and off-record managers.
- // There does not appear to be a separate ExtensionSystem for on-record and
- // off-record profiles, so ExtensionSystem cannot own the EDER.
- scoped_ptr<ExtensionDownloadsEventRouter> extension_event_router_;
-#endif
-
// The directory most recently chosen by the user in response to a Save As
// dialog for a regular download.
FilePath last_download_path_;

Powered by Google App Engine
This is Rietveld 408576698