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; ...@@ -430,7 +430,7 @@ chrome.fileManagerPrivate.SearchParams;
/** /**
* @typedef {{ * @typedef {{
* query: string, * query: string,
* types: string, * types: !chrome.fileManagerPrivate.SearchType,
* maxResults: number * maxResults: number
* }} * }}
*/ */
...@@ -443,7 +443,7 @@ chrome.fileManagerPrivate.SearchMetadataParams; ...@@ -443,7 +443,7 @@ chrome.fileManagerPrivate.SearchMetadataParams;
* availableOffline: (boolean|undefined) * availableOffline: (boolean|undefined)
* }} * }}
*/ */
chrome.fileManagerPrivate.SearchResult; chrome.fileManagerPrivate.DriveMetadataSearchResult;
/** /**
* @typedef {{ * @typedef {{
...@@ -749,12 +749,11 @@ chrome.fileManagerPrivate.searchDrive = function(searchParams, callback) {}; ...@@ -749,12 +749,11 @@ chrome.fileManagerPrivate.searchDrive = function(searchParams, callback) {};
/** /**
* Performs drive metadata search. |searchParams| |callback| * Performs drive metadata search. |searchParams| |callback|
* @param {chrome.fileManagerPrivate.SearchMetadataParams} searchParams * @param {!chrome.fileManagerPrivate.SearchMetadataParams} searchParams
* @param {function((!Array<!chrome.fileManagerPrivate.SearchResult>|undefined))} * @param {function(!Array<!chrome.fileManagerPrivate.DriveMetadataSearchResult>):void}
* callback * callback
*/ */
chrome.fileManagerPrivate.searchDriveMetadata = function(searchParams, chrome.fileManagerPrivate.searchDriveMetadata = function(searchParams, callback) {};
callback) {};
/** /**
* Search for files in the given volume, whose content hash matches the list of * Search for files in the given volume, whose content hash matches the list of
......
...@@ -240,7 +240,11 @@ class LauncherSearch { ...@@ -240,7 +240,11 @@ class LauncherSearch {
* @private * @private
*/ */
queryDriveEntries_(queryId, query, limit, startTime) { 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) => { return new Promise((resolve, reject) => {
chrome.fileManagerPrivate.searchDriveMetadata(param, results => { chrome.fileManagerPrivate.searchDriveMetadata(param, results => {
chrome.fileManagerPrivate.getDriveConnectionState(connectionState => { chrome.fileManagerPrivate.getDriveConnectionState(connectionState => {
...@@ -270,7 +274,12 @@ class LauncherSearch { ...@@ -270,7 +274,12 @@ class LauncherSearch {
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
chrome.fileManagerPrivate.searchFiles( chrome.fileManagerPrivate.searchFiles(
{query: query, types: 'ALL', maxResults: limit}, results => { {
query: query,
types: chrome.fileManagerPrivate.SearchType.ALL,
maxResults: limit
},
results => {
chrome.metricsPrivate.recordTime( chrome.metricsPrivate.recordTime(
'FileBrowser.LauncherSearch.Local', Date.now() - startTime); 'FileBrowser.LauncherSearch.Local', Date.now() - startTime);
resolve(results); resolve(results);
......
...@@ -234,13 +234,13 @@ class DriveMetadataSearchContentScanner extends ContentScanner { ...@@ -234,13 +234,13 @@ class DriveMetadataSearchContentScanner extends ContentScanner {
/** /**
* The search types on the Drive File System. * The search types on the Drive File System.
* @enum {string} * @enum {!chrome.fileManagerPrivate.SearchType}
*/ */
DriveMetadataSearchContentScanner.SearchType = { DriveMetadataSearchContentScanner.SearchType = {
SEARCH_ALL: 'ALL', SEARCH_ALL: chrome.fileManagerPrivate.SearchType.ALL,
SEARCH_SHARED_WITH_ME: 'SHARED_WITH_ME', SEARCH_SHARED_WITH_ME: chrome.fileManagerPrivate.SearchType.SHARED_WITH_ME,
SEARCH_RECENT_FILES: 'EXCLUDE_DIRECTORIES', SEARCH_RECENT_FILES: chrome.fileManagerPrivate.SearchType.EXCLUDE_DIRECTORIES,
SEARCH_OFFLINE: 'OFFLINE' SEARCH_OFFLINE: chrome.fileManagerPrivate.SearchType.OFFLINE,
}; };
Object.freeze(DriveMetadataSearchContentScanner.SearchType); Object.freeze(DriveMetadataSearchContentScanner.SearchType);
......
...@@ -153,7 +153,7 @@ class SearchController { ...@@ -153,7 +153,7 @@ class SearchController {
chrome.fileManagerPrivate.searchDriveMetadata( chrome.fileManagerPrivate.searchDriveMetadata(
{ {
query: searchString, query: searchString,
types: 'ALL', types: chrome.fileManagerPrivate.SearchType.ALL,
maxResults: 4, maxResults: 4,
}, },
suggestions => { suggestions => {
......
...@@ -262,7 +262,8 @@ SearchBox.AutocompleteListItem_ = ...@@ -262,7 +262,8 @@ SearchBox.AutocompleteListItem_ =
class AutocompleteListItem_ extends cr.ui.ListItem { class AutocompleteListItem_ extends cr.ui.ListItem {
/** /**
* @param {Document} document Document. * @param {Document} document Document.
* @param {SearchItem|chrome.fileManagerPrivate.SearchResult} item An object * @param {SearchItem|chrome.fileManagerPrivate.DriveMetadataSearchResult}
* item An object
* representing a suggestion. * representing a suggestion.
*/ */
constructor(document, item) { constructor(document, item) {
......
...@@ -28,6 +28,12 @@ chrome.fileManagerPrivate = { ...@@ -28,6 +28,12 @@ chrome.fileManagerPrivate = {
PACK_WITH: 'pack_with', PACK_WITH: 'pack_with',
SHARE_WITH: 'share_with', SHARE_WITH: 'share_with',
}, },
SearchType: {
ALL: 'ALL',
SHARED_WITH_ME: 'SHARED_WITH_ME',
EXCLUDE_DIRECTORIES: 'EXCLUDE_DIRECTORIES',
OFFLINE: 'OFFLINE',
},
currentId_: 'test@example.com', currentId_: 'test@example.com',
displayedId_: 'test@example.com', displayedId_: 'test@example.com',
preferences_: { preferences_: {
...@@ -176,8 +182,8 @@ chrome.fileManagerPrivate = { ...@@ -176,8 +182,8 @@ chrome.fileManagerPrivate = {
setTimeout(callback, 0, entries); setTimeout(callback, 0, entries);
}, },
searchDriveMetadata: (searchParams, callback) => { searchDriveMetadata: (searchParams, callback) => {
// Returns chrome.fileManagerPrivate.SearchResult[]. // Returns chrome.fileManagerPrivate.DriveMetadataSearchResult[].
// chrome.fileManagerPrivate.SearchResult { entry: Entry, // chrome.fileManagerPrivate.DriveMetadataSearchResult { entry: Entry,
// highlightedBaseName: string } // highlightedBaseName: string }
setTimeout(callback, 0, []); 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