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

Unified Diff: chrome/browser/extensions/api/downloads/downloads_api.h

Issue 22612003: Warn when extensions suggest conflicting download filenames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r216682 Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/api/downloads/downloads_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/downloads/downloads_api.h
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.h b/chrome/browser/extensions/api/downloads/downloads_api.h
index a6fda46a07de3433650ce90f29f80a300a6cd3cb..e7db6d0f899b2313c3ecbd664be080c8af104b8e 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api.h
+++ b/chrome/browser/extensions/api/downloads/downloads_api.h
@@ -17,6 +17,7 @@
#include "chrome/browser/download/download_path_reservation_tracker.h"
#include "chrome/browser/extensions/event_router.h"
#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/extension_warning_set.h"
#include "chrome/common/extensions/api/downloads.h"
#include "content/public/browser/download_item.h"
#include "content/public/browser/download_manager.h"
@@ -298,6 +299,21 @@ class ExtensionDownloadsEventRouter : public extensions::EventRouter::Observer,
DownloadPathReservationTracker::FilenameConflictAction)>
FilenameChangedCallback;
+ // The logic for how to handle conflicting filename suggestions from multiple
+ // extensions is split out here for testing.
+ static void DetermineFilenameInternal(
+ const base::FilePath& filename,
+ extensions::api::downloads::FilenameConflictAction conflict_action,
+ const std::string& suggesting_extension_id,
+ const base::Time& suggesting_install_time,
+ const std::string& incumbent_extension_id,
+ const base::Time& incumbent_install_time,
+ std::string* winner_extension_id,
+ base::FilePath* determined_filename,
+ extensions::api::downloads::FilenameConflictAction*
+ determined_conflict_action,
+ extensions::ExtensionWarningSet* warnings);
+
// A downloads.onDeterminingFilename listener has returned. If the extension
// wishes to override the download's filename, then |filename| will be
// non-empty. |filename| will be interpreted as a relative path, appended to
« no previous file with comments | « no previous file | chrome/browser/extensions/api/downloads/downloads_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698