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

Unified Diff: ui/file_manager/file_manager/background/js/duplicate_finder.js

Issue 2568723005: Add scan mode to choose whether to do content scan or only history check. (Closed)
Patch Set: Remove unrelated changes that was put in by mistake. Created 4 years 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 | ui/file_manager/file_manager/background/js/media_scanner.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/background/js/duplicate_finder.js
diff --git a/ui/file_manager/file_manager/background/js/duplicate_finder.js b/ui/file_manager/file_manager/background/js/duplicate_finder.js
index 371e7cd8c1f92facb5487c8b8686534a8c07aba6..f6639534d11e4ee75462d4d419413e4433967107 100644
--- a/ui/file_manager/file_manager/background/js/duplicate_finder.js
+++ b/ui/file_manager/file_manager/background/js/duplicate_finder.js
@@ -200,10 +200,11 @@ importer.DispositionChecker = function(historyLoader, contentMatcher) {
/**
* @param {!FileEntry} entry
* @param {!importer.Destination} destination
+ * @param {!importer.ScanMode} mode
* @return {!Promise<!importer.Disposition>}
*/
importer.DispositionChecker.prototype.getDisposition =
- function(entry, destination) {
+ function(entry, destination, mode) {
if (destination !== importer.Destination.GOOGLE_DRIVE) {
return Promise.reject('Unsupported destination: ' + destination);
}
@@ -220,20 +221,24 @@ importer.DispositionChecker.prototype.getDisposition =
function(duplicate) {
if (duplicate) {
resolve(importer.Disposition.HISTORY_DUPLICATE);
- } else {
- this.contentMatcher_.isDuplicate(entry)
- .then(
- /** @param {boolean} duplicate */
- function(duplicate) {
- if (duplicate) {
- resolve(
- importer.Disposition.CONTENT_DUPLICATE);
- } else {
- resolve(importer.Disposition.ORIGINAL);
- }
- });
- }
- }.bind(this));
+ return;
+ }
+ if (mode == importer.ScanMode.HISTORY) {
+ resolve(importer.Disposition.ORIGINAL);
+ return;
+ }
+ this.contentMatcher_.isDuplicate(entry)
+ .then(
+ /** @param {boolean} duplicate */
+ function(duplicate) {
+ if (duplicate) {
+ resolve(
+ importer.Disposition.CONTENT_DUPLICATE);
+ } else {
+ resolve(importer.Disposition.ORIGINAL);
+ }
+ });
+ }.bind(this));
}.bind(this));
};
@@ -274,7 +279,8 @@ importer.DispositionChecker.prototype.hasHistoryDuplicate_ =
* @param {!importer.HistoryLoader} historyLoader
* @param {!analytics.Tracker} tracker
*
- * @return {function(!FileEntry, !importer.Destination):
+ * @return {function(!FileEntry, !importer.Destination,
+ * !importer.ScanMode):
* !Promise<!importer.Disposition>}
*/
importer.DispositionChecker.createChecker =
« no previous file with comments | « no previous file | ui/file_manager/file_manager/background/js/media_scanner.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698