Commit 0a3bc3a4 authored by Anand K. Mistry's avatar Anand K. Mistry Committed by Commit Bot

Fix closure references to drive search type.

crrev.com/650170 renamed SearchResult to DriveMetadataSearchResult. This
change fixes those closure references.

chrome.fileManagerPrivate.SearchMetadataParams.types is of type SearchType.
Use that type instead of a string.

Both thse changes bring us closer to using a generated externs file
instead of a hand-updated one.

Bug: 613096
Change-Id: If3a007c8c9e3b9e8183578a740433e9847966be8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1892633Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Anand Mistry <amistry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712060}
parent e036cb41
......@@ -430,7 +430,7 @@ chrome.fileManagerPrivate.SearchParams;
/**
* @typedef {{
* query: string,
* types: string,
* types: !chrome.fileManagerPrivate.SearchType,
* maxResults: number
* }}
*/
......@@ -443,7 +443,7 @@ chrome.fileManagerPrivate.SearchMetadataParams;
* availableOffline: (boolean|undefined)
* }}
*/
chrome.fileManagerPrivate.SearchResult;
chrome.fileManagerPrivate.DriveMetadataSearchResult;
/**
* @typedef {{
......@@ -749,12 +749,11 @@ chrome.fileManagerPrivate.searchDrive = function(searchParams, callback) {};
/**
* Performs drive metadata search. |searchParams| |callback|
* @param {chrome.fileManagerPrivate.SearchMetadataParams} searchParams
* @param {function((!Array<!chrome.fileManagerPrivate.SearchResult>|undefined))}
* @param {!chrome.fileManagerPrivate.SearchMetadataParams} searchParams
* @param {function(!Array<!chrome.fileManagerPrivate.DriveMetadataSearchResult>):void}
* callback
*/
chrome.fileManagerPrivate.searchDriveMetadata = function(searchParams,
callback) {};
chrome.fileManagerPrivate.searchDriveMetadata = function(searchParams, callback) {};
/**
* Search for files in the given volume, whose content hash matches the list of
......
......@@ -240,7 +240,11 @@ class LauncherSearch {
* @private
*/
queryDriveEntries_(queryId, query, limit, startTime) {
const param = {query: query, types: 'ALL', maxResults: limit};
const param = {
query: query,
types: chrome.fileManagerPrivate.SearchType.ALL,
maxResults: limit
};
return new Promise((resolve, reject) => {
chrome.fileManagerPrivate.searchDriveMetadata(param, results => {
chrome.fileManagerPrivate.getDriveConnectionState(connectionState => {
......@@ -270,7 +274,12 @@ class LauncherSearch {
}
return new Promise((resolve, reject) => {
chrome.fileManagerPrivate.searchFiles(
{query: query, types: 'ALL', maxResults: limit}, results => {
{
query: query,
types: chrome.fileManagerPrivate.SearchType.ALL,
maxResults: limit
},
results => {
chrome.metricsPrivate.recordTime(
'FileBrowser.LauncherSearch.Local', Date.now() - startTime);
resolve(results);
......
......@@ -234,13 +234,13 @@ class DriveMetadataSearchContentScanner extends ContentScanner {
/**
* The search types on the Drive File System.
* @enum {string}
* @enum {!chrome.fileManagerPrivate.SearchType}
*/
DriveMetadataSearchContentScanner.SearchType = {
SEARCH_ALL: 'ALL',
SEARCH_SHARED_WITH_ME: 'SHARED_WITH_ME',
SEARCH_RECENT_FILES: 'EXCLUDE_DIRECTORIES',
SEARCH_OFFLINE: 'OFFLINE'
SEARCH_ALL: chrome.fileManagerPrivate.SearchType.ALL,
SEARCH_SHARED_WITH_ME: chrome.fileManagerPrivate.SearchType.SHARED_WITH_ME,
SEARCH_RECENT_FILES: chrome.fileManagerPrivate.SearchType.EXCLUDE_DIRECTORIES,
SEARCH_OFFLINE: chrome.fileManagerPrivate.SearchType.OFFLINE,
};
Object.freeze(DriveMetadataSearchContentScanner.SearchType);
......
......@@ -153,7 +153,7 @@ class SearchController {
chrome.fileManagerPrivate.searchDriveMetadata(
{
query: searchString,
types: 'ALL',
types: chrome.fileManagerPrivate.SearchType.ALL,
maxResults: 4,
},
suggestions => {
......
......@@ -262,7 +262,8 @@ SearchBox.AutocompleteListItem_ =
class AutocompleteListItem_ extends cr.ui.ListItem {
/**
* @param {Document} document Document.
* @param {SearchItem|chrome.fileManagerPrivate.SearchResult} item An object
* @param {SearchItem|chrome.fileManagerPrivate.DriveMetadataSearchResult}
* item An object
* representing a suggestion.
*/
constructor(document, item) {
......
......@@ -28,6 +28,12 @@ chrome.fileManagerPrivate = {
PACK_WITH: 'pack_with',
SHARE_WITH: 'share_with',
},
SearchType: {
ALL: 'ALL',
SHARED_WITH_ME: 'SHARED_WITH_ME',
EXCLUDE_DIRECTORIES: 'EXCLUDE_DIRECTORIES',
OFFLINE: 'OFFLINE',
},
currentId_: 'test@example.com',
displayedId_: 'test@example.com',
preferences_: {
......@@ -176,8 +182,8 @@ chrome.fileManagerPrivate = {
setTimeout(callback, 0, entries);
},
searchDriveMetadata: (searchParams, callback) => {
// Returns chrome.fileManagerPrivate.SearchResult[].
// chrome.fileManagerPrivate.SearchResult { entry: Entry,
// Returns chrome.fileManagerPrivate.DriveMetadataSearchResult[].
// chrome.fileManagerPrivate.DriveMetadataSearchResult { entry: Entry,
// highlightedBaseName: string }
setTimeout(callback, 0, []);
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment