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

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: @r176665 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..7352d07184e54b116ec6d13ec4fdcd36c6d84700 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,17 @@ class ChromeDownloadManagerDelegate
private:
friend class base::RefCountedThreadSafe<ChromeDownloadManagerDelegate>;
+ struct ContinueFilenameDeterminationInfo {
Randy Smith (Not in Mondays) 2013/01/14 21:02:29 References to this structure below are references
benjhayden 2013/01/17 02:52:05 Done.
+ ContinueFilenameDeterminationInfo();
+ ~ContinueFilenameDeterminationInfo();
+
+ int32 download_id;
+ content::DownloadTargetCallback callback;
+ content::DownloadDangerType danger_type;
+ bool visited_referrer_before;
+ bool should_prompt;
+ };
+
// content::NotificationObserver implementation.
virtual void Observe(int type,
const content::NotificationSource& source,
@@ -194,6 +204,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(
+ const ContinueFilenameDeterminationInfo& continue_info,
+ 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(
+ const ContinueFilenameDeterminationInfo& continue_info,
+ const FilePath& suggested_path,
+ bool is_forced_path);
+
Randy Smith (Not in Mondays) 2013/01/14 21:02:29 I'm concerned about the names of these two functio
benjhayden 2013/01/17 02:52:05 I didn't put any thought into naming these methods
Randy Smith (Not in Mondays) 2013/01/17 19:15:42 Can we find something that's an imperative? I'm g
benjhayden 2013/01/18 20:59:50 All of the other methods on EDER that dispatch eve
Randy Smith (Not in Mondays) 2013/01/22 19:43:07 Sure.
// Called on the UI thread once the final target path is available.
void OnTargetPathDetermined(
int32 download_id,
@@ -230,20 +256,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_;
Randy Smith (Not in Mondays) 2013/01/14 21:02:29 So do you remember why we wanted to move EDER to D
benjhayden 2013/01/17 02:52:05 The downloadsInternal API needs to access the EDER
Randy Smith (Not in Mondays) 2013/01/17 19:15:42 Glancing at that file, it looks like it's only acc
benjhayden 2013/01/18 20:59:50 The EDER static methods that downloadsInternal cal
-#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